1.3.1 composer用法

1、将github仓库代码down到本地

方法一

echo "# ccc" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/liaozongchao/ccc.git
git push -u origin master

方法二

git remote add origin https://github.com/liaozongchao/ccc.git
git push -u origin master

2、初始化包

composer init

结果大概如下(composer.json):

{
    "name": "liao/liming",
    "description": "liming",
    "license": "Apache-2.0",
    "keywords": ["liao", "sdk"],
    "homepage": "https://github.com/liaozongchao/bbb",
    "type": "library",
    "authors": [
        {
            "name": "liaozongchao",
            "email": "liaozongchao@yiihua.com"
        }
    ],
    "require": {},
    "autoload": {
        "files": [
            "src/app/functions.php"
            ],
        "psr-4": {
            "App\\": "src/app"
        }
    }
}

注明:

  • files:直接引用文件
  • psr-4 : 按照psr-4标准引用类文件
    引用文件格式

代码格式

<?php
namespace App\Api;

class Home{

} 
?>

3、将代码推送到github上

git add README.md
git commit -m "first commit"
git push -u origin master

注意:修改.git/config(url = https://liaozongchao@github.com/liaozongchao/ccc.git)

4、登录到https://packagist.org/packages/submit 网站操作

提交:https://github.com/liaozongchao/ccc

总结:以上操作即可成功,安装库:

composer require liao/liming:dev-master

results matching ""

    No results matching ""

    results matching ""

      No results matching ""