Home  >  Article  >  Backend Development  >  How to contribute your source code to PHP_PHP Tutorial

How to contribute your source code to PHP_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:34:07858browse

PHP has previously migrated the source code to git for management, and also made a mirror on github (https://github.com/php/php-src). In this way, it is more convenient to update Many developers contribute code to PHP.

I am writing this article today to give students in China, who are willing to contribute to the PHP open source community, an example of how to contribute your wisdom to PHP.

Now, assuming you want to contribute a new feature to , in addition to the following steps, you also need to submit an RFC on wiki.php.net. I will introduce this later. Now let’s keep it simple. Click here, assuming you just want to fix a bug for PHP (generally speaking, you can find bugs that have been reported in PHP here: PHP Bugs). Now assume that you have already figured out how to fix this bug.

1. First, you need to have a github account. If not, register here: Register github.

2. Fork the source code of PHP. There is a fork button in the upper right corner of the PHP Github page. Click it

3. After Fork, you will have your own PHP source code repository. Now you can modify the PHP source code in this repository to fix bugs for it.

I will provide you with a simple explanation here. If you start development on Github, there will be an explanation on your own PHP code repository page, such as on my PHP repository page https://github. com/laruence/php-src:

ssh  git@github.com:laruence/php-src.git

Then, on the local development environment, I executed:

$git clone git@github.com:laruence/php-src.git

Then, you will get a php-src directory, go in and develop.

4. After you complete the repair, you submit it to your own PHP repository. Then, in the upper right corner of the Github page of your PHP source code repository, there will be a pull request button. Click it.

When submitting, please pay attention to the format of your submission description. First of all, the first line should be a short description (maximum 79 characters) explaining what changes you have made. If you cannot finish a sentence, insert a blank line , and then enter a large description (see New Commit Message Format):

<max 79 characters short description>\n
\n
<long description, 79 chars per line>
\n

If you are fixing a bug listed on bugs.php.net, your brief description should look like this:

Fixed Bug #bug号 (Bug的描述)

5. Then, fill in the relevant information, and Github will send a Pull Request email containing your update to the PHP pull request email group (you don’t have to worry about your English, as long as you can speak it, we will I can understand it. Of course, if you really don’t want to write in English, it doesn’t matter. Just write in Chinese. I will handle it when I see it. If I can’t handle it, I will also translate it for everyone).

6. Finally, if the PHP Committers think your fix is ​​correct (there are some options to pay attention to when contributing code to PHP, I leave them below). Your Pull Request will be merged into the PHP source code.

Now, assuming that what you want to submit is an update (adding new functions, adding new syntax), then when you submit the Pull Request, you also need to send an email to the internals@lists.php.net mailing group , to explain why you want to submit this update, and let people in this mailing group discuss it together to help you improve your ideas.

Finally, after you have contributed some updates to PHP (updates accepted by the Committer), then you can try to apply for your own PHP Developer account on: Register Svn Accout.

Appendix:

There are several points to note when contributing source code to PHP (frequently asked questions):

  1. Only write C89-compatible code. For example, do not use single-line comments (//). The definition of variables must be before all statements (the beginning of the block)..
  2. Variable naming should follow PHP’s existing specifications and do not use camel case naming.
  3. For some very small updates, such as spelling errors in the code, you are still encouraged to submit patches on bugs.php.net. After all, Merge Pull Request can sometimes be more troublesome.

For more PHP code specifications, see here: Submitting patch

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/752327.htmlTechArticlePHP previously migrated the source code to git for management, and also on github (https://github.com /php/php-src), this will make it easier for more developers to contribute to PHP...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn