🐘 php-src-devtools 🐳
Tools to make it easier to contribute to PHP itself (php-src). Uses Docker containers for building, running and testing PHP from source.
$ composer global require aboks/php-src-devtools $ git clone https://github.com/php/php-src.git && cd php-src # write a test, or make your own changes to PHP $ php-src-devtools test
Even though there is a thriving open source community for projects written in PHP, only a very limited number of these people contribute to PHP itself. This can partly be explained by the fact that contributing to PHP internals is quite different from contributing to a PHP project: it uses a different language (C instead of PHP), different tools, and another workflow.
This project aims to remove some of these barriers for PHP developers to become PHP core developers:
- Compiling and testing PHP within a Docker container removes the need to install any build dependencies, which can clutter your system or not be easily available for your OS. In particular, it provides a greatly simplified path to get started for Windows users.
- Most PHP developers will be used to installing tools like this using Composer.
- Using tools that PHP developers might be already using (Symfony Console and Docker) provides a familiar experience.
- The console application abstracts some of the necessary build steps away, and makes the possible actions discoverable.
For more information about contributing to PHP, see the slides for my "Getting started with PHP core development" conference talk.
Ensure that Docker is installed and running on your system.
The easiest way to install this tool is as a global composer package:
$ composer global require aboks/php-src-devtools
Alternatively, clone or download this repository somewhere, run
composer install to install dependencies, and ensure that
php-src-devtools is on your
In the folder that contains your clone of php-src, run:
php-src-devtools buildto build PHP. Note that the initial build may take about an hour.
php-src-devtools testto run the full PHP testsuite. You can use
php-src-devtools test path/to/test.phptto run a single test, or
php-src-devtools test ext/footo test a single extension.
php-src-devtools phpto run the compiled PHP CLI, e.g.
php-src-devtools php -ifor phpinfo.
php-src-devtools listto see all subcommands, or
php-src-devtools helpfor additional help.
This tool is still in a pretty experimental stage, but the basic things like building PHP from source and running tests should work fine. Please try it out and report any issues and possible improvements that you encounter. Pull requests are welcome.
This project adheres to Semantic Versioning.
The code is released under the MIT license.