This article introduces the content of the PHP extension development test List, has a certain reference value, now share to everyone, the need for friends can refer to
To make a successful PHP expansion package, not just simply put the code in the folder, but there are a lot of factors to determine whether your extension is good. The contents of the following checklist will help refine your extension and get more attention in the PHP community.
1. Choose a proper name for your extension
Make sure that your naming is not used by other projects.
The name of the extension needs to be consistent with your PHP namespace.
Don't use your name or any other personal color in your namespace.
2. Expand your open source
GitHub can manage this category of public projects for free.
GitHub can help you manage this open source project and make it easier for others to get your extensions.
If you don't want to use it, you can try a substitute: bitbucket.
3. Friendly to auto-loading
4. Release via Composer
Make sure you can find your class library through Composer, Composer is a dependency management tool for PHP
Posted on Packagist, Packagist is a major Composer-pack warehouse.
5. Not limited to the framework
6. Follow a coding style
It is strongly recommended that you stick to the PSR-2 coding style.
Use code Auto-formatting tools, such as PHP Coding standards Fixer.
Use code style detection tools, such as PHP code Sniffer.
7. Writing unit Tests
Cover most of the code.
Using PHPUnit, a common PHP unit testing framework.
Other options: Phpspec, Behat, Atoum, Codeception.
8. Write a comment for the code
Treat annotations as a built-in document.
Code annotations can also improve the IDE's code autocomplete capabilities, such as Phpstorm.
can be automatically converted into API documentation to view Phpdocumentor.
9. Semantic versioning of the language
Use the semantic version number to manage the version number.
Follow the main version. Minor version. Patch version specification.
Let developers safely upgrade software without worrying about disruptive changes.
Please remember to label the release version in time!
10. Keep the log updated regularly
11. Using Continuous Integration
Use the service to automatically check whether the encoding is standard and to run the test.
It's a good idea to run tests in several different versions of PHP.
Be sure to run automatically when you submit or pull.
Reference: Travis-ci,scrutinizer, Circle-ci.
12. Write a large number of use documents
An excellent document is essential for an expansion package.
At a minimum, make sure that you have a detailed readme file in the library.
You can try to host the document in GitHub Pages.
Available References: Read the Docs.
13. Include an Authorization (License)
Includes an authorization agreement that can effectively protect the results of your work and is easy to do.
Refer to choosealicense.com. Most PHP open source projects use the MIT protocol.
At a minimum, include the LICENSE file in the code base.
You may also consider adding your license agreement to the Docblocks.
14. Welcome the contribution of all
Want to help improve the project, it must be a lot of requests for the contribution of everyone!
There is a copy of the contributing file that lists the contributors ' names.
Use this document to interpret project environmental requirements, such as test environments.
For more modern PHP knowledge, go to the laravel/php knowledge community