composer 包

  1. 根据功能解释框架基础结构
    友情提示 composer 镜像源建议用阿里云的镜像

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

  1. 引入composer
    首先打开命令行通过cmd操作;前提操作 -> composer安装成功(|ू・ω・` )自个百度安装吧)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
PS D:laravel> composer init

Welcome to the Composer config generator

This command will guide you through creating your composer.json config.

Package name (<vendor>/<name>) [administrator/laravel]: uiste/tiny-laravel
Description []: This is a small project modeled after laravel
Author [uiste <2598352200@qq.com>, n to skip]: uiste <uiste@test.com>
Minimum Stability []:
Package Type (e.g. library, project, metapackage, composer-plugin) []: library
License []: MIT

Define your dependencies.

Would you like to define your dependencies (require) interactively [yes]? n
Would you like to define your dev dependencies (require-dev) interactively [yes]? n
{
"name": "uiste/tiny-laravel",
"description": "This is a small project modeled after laravel",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "uiste",
"email": "uiste@test.com"
}
],
"minimum-stability": "dev",
"require": {}
}
Do you confirm generation [yes]? yes

对于composer init 的结果解释:

命令 解释 案例
Package name 项目名称 uiste/tiny-laravel
Description 项目描述(不要中文) This is a small project modeled after laravel
Author 作者 uiste uiste@test.com
Minimum Stability 稳定版本 dev
Package Type 项目类型 library
License 开源 MIT

最后两个设置为 n 就行了

然后修改一下json文件,添加小laravel的命名空间

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"name": "uiste/tiny-laravel",
"description": "This is a small projet modeled after laravel",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "uiste",
"email": "uiste@test.com"
}
],
"autoload":{
"psr-4":{
"uiste\\TinyLaravel\\":"./src/"
}
},
"require": {}
}

对应的项目目录

1
2
3
4
5
6
7
tiny-laravel 组件目录
├─src 项目目录
│ ├─Container 容器目录
│ └─ ... 更多类库目录

├─composer.json 过
└─README.md README 文件