wilon / wilon.github.io

A simple notes show page.
https://wilon.github.io
34 stars 4 forks source link

PHPer如何发布 composer 包? #5

Open wilon opened 7 years ago

wilon commented 7 years ago

https://github.com/wilon/simple-php-debug 为例

1. 提交源码

{
    // 包名
    "name": "wilon/simple-php-debug",
    // 包描述
    "description": "Simple PHP Debug, better output and write log.",
    // 许可证
    "license": "MIT",
    // 主页
    "homepage": "https://wilon.github.io",
    // 支持
    "support": {
        // 提问
        "issues": "https://github.com/wilon/simple-php-debug/issues",
        // 源码
        "source": "https://github.com/wilon/simple-php-debug"
    },
    // 关键字
    "keywords": ["php", "debug", "dump"],
    // 作者
    "authors": [
        {
            "name": "Weilong Wang",
            "email": "wilonx@163.com"
        }
    ],
    // 包依赖
    "require": {
        "php": ">=5.3"
    },
    // 自动加载
    "autoload": {
        // 按文件
        "files": [
            "src/SimpleDebug.php"
        ],
        // 按psr-4,即按命名空间自动引入
        "psr-4": {
            "Illuminate\\Database\\": ""
        }
    },
    // 配置
    "config": {
        "sort-packages": true
    },
    "minimum-stability": "dev"
}

2. https://packagist.org/ 注册登录

3. 配置GitHub项目


测试下 composer require xxx/xxxx