packagist
作者QQ:67065435 QQ群:669756510
本站内容全部为作者原创,转载请注明出处!
点击“Start a project”创建一个项目
输入项目名称、描述(Description),设为public,并用README初始化这个项目
点击Create repository完成创建
点击Clone or download复制链接地址
在个人电脑下载这个项目
git clone https://github.com/space/package.git进入项目 根目录 执行
所有选项选择默认,或者参考如下配置: 这里一定注意: name值必须是小写!!
composer init{ "name": "space/package", "type": "library", "description": "FastDFS client engine.", "keywords": [ "DFS", "FastDFS" ], "homepage": "https://github.com/space/package", "license": "MIT", "support": { "issues": "https://github.com/space/package/issues" }, "authors": [ { "name": "豆包嘿嘿~", "email": "2233466866@qq.com", "homepage": "http://weibo.com/u/3215774830/home" } ], "require": { "php": ">=7.0.1" }, "require-dev": [], "suggest": { "ext-fastcommon": "https://github.com/happyfish100/libfastcommon/releases", "ext-fastdfs_client": "https://github.com/happyfish100/fastdfs/releases" }, "autoload": { "classmap": [ "src/" ] } }composer.json有多种方式引入类文件
"autoload": { "psr-0": { "Package1\\": "package1/", "Package2\\": "package2/" }, "psr-4": { "Package3\\": "package3/", "Package4\\": "package4/" }, "classmap": [ "Package5/", "Package6/" ], "include-path": [ "Package7/", "Package8/" ], "files": [ "Package9/MyClass1.php", "Package9/MyClass2.php", "Package9/MyClass3.php" ] }在根目录创建LICENSE,仅供参考
Copyright (c) 2016-2017 Zhihuan Geng Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.提交项目文件的更新
git status git commit -a -m "更新项目" git checkout -b test git push origin test:test在https://github.com/space/package 添加Pull request并接受提交
在https://github.com/space/package 点击: release->Draft a new release->publish release, 创建1.0发行版本
在Repository URL输入https://github.com/space/package
点击Check检查,防止与其它项目重复,没有问题则Submit该项目
会看到你的项目没有开启自动更新,点击“GitHub Service Hook”
根据“How to update packages?”文档的提示开启更新,如看不懂英文文档,参照下面步骤
在https://github.com/space/package ,点击:
- Settings->Integrations & services->添加Packagist->Packagist
填写表单中相关的选项
其中User为https://packagist.org 用户名
其中Token为https://packagist.org 首页->用户名->Profile->中的隐藏信息,需要点击“Show API Token”显示
其中Domain为空或“https://packagist.org”
填写完成后提交表单,即可完成自动更新
尝试安装
composer update nothing composer require space/package