Composer integration

Source: https://github.com/linuxforphp/linuxforcomposer
Issues: https://github.com/linuxforphp/linuxforcomposer/issues
Packagist: https://packagist.org/packages/linuxforphp/linuxforcomposer
Documentation: https://linux-for-composer.readthedocs.io/

Prerequisites:

You can now configure and run Linux for PHP containers for your PHP projects without ever touching the Docker command line!

You can create a custom configuration for each PHP project you have and launch the Linux for PHP containers directly from within your projects' working directories!

Installation and configuration

To install the Linux for Composer package, you can simply run the following commands:

composer require --dev linuxforphp/linuxforcomposer
php vendor/bin/linuxforcomposer.phar

NOTE: On Windows, please use the Linux for Composer PHAR file in the 'vendor/linuxforphp/linuxforcomposer/bin' folder.

You will now be able to modify the 'linuxforcomposer.json' file according to the specific needs of your project.

Configuration

To learn more about the configuration settings, please see the project's documentation: https://linux-for-composer.readthedocs.io/en/latest/configuration.html.

Usage

Once you are done modifying the JSON file, you can start the container or containers by issuing the following command:

php vendor/bin/linuxforcomposer.phar docker:run start

In order to stop all the containers that were started using Linux for Composer, please enter the following command:

php vendor/bin/linuxforcomposer.phar docker:run stop

One final note: you can install Linux for Composer for your entire system by copying the binary in a folder that is in your PATH:

cp vendor/linuxforphp/linuxforcomposer/bin/linuxforcomposer.phar /usr/local/bin/linuxforcomposer

You would then be able to invoke the binary directly from within the working directories of your PHP projects:

cd /my/favorite/php/project
linuxforcomposer docker:run start

Have a lot of fun!