# 附录\* 通过composer发布自己的包

前提：

已经学会了composer的基础用法，知道composer.json的作用，知道install和update命令的作用。\
你会使用git，并在github上有一个账号。

基本流程：

1.在github上创建自己的项目，例如：helloworld

2.将项目通过git克隆到本地，创建composer.json

3.commit并push到github上

4.到<https://packagist.org/> 上点击右上角"submit package"，需要登录，点击"login with github"使用github账号登录即可，初次登录会让你登记邮箱，完了再次点击"submit package"。

5.填写项目地址"Repository URL"，这个url就是你github上helloworld项目的url。

6.点击"check"按钮，系统自动检测你的项目中composer.json是否合格，并给出原因。如果没有错误的话，请点击提交。

7.包创建成功，可以根据提示继续配置github自动同步功能，这样每次push后，packagist对应包的版本号也会更新。

8.修改包并更新，修改后git push，然后到使用该包的项目中执行composer --dev --prefer-source update \[包名] ，加--prefer-source意思是从github上检出最新版本。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://php7.shujuwajue.com/fu-5f55-tong-guo-composer-fa-bu-zi-ji-de-bao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
