This repository provides an example implementation of Composer Stager as a console command for use on the command-line,e.g., via a terminal or a cron job. It is provides for illustration purposes only; it is unsupported.
This repository is for illustration only. It is unsupported. There are no plans to release it as an official, supported package unless the community indicates adequate demand. Furthermore, it is based on a version of Composer Stager from the very early stages of development and may not exactly reflect its current state. Consult that project for the most current integration details.
The console command is used by installing it via Git and invoking its executable:
$ git clone https://github.com/php-tuf/composer-stager-console.git
$ php composer-stager-console/bin/composer-stage
begin
- Begins the staging process by copying the active directory to the staging directory.stage
- Executes a Composer command in the staging directory.commit
- Makes the staged changes live by syncing the active directory with the staging directory.clean
- Removes the staging directory.
# Copy the codebase to the staging directory.
$ composer-stager begin
# Run a Composer command on it.
$ composer-stager stage -- require example/package --update-with-all-dependencies
# Sync the changes back to the active directory.
$ composer-stager commit --no-interaction
# Remove the staging directory.
$ composer-stager clean --no-interaction
This repository provides the simplest implementation possible in its context. The fact that it is a Symfony Console application is incidental but does require certain scaffolding that is beside the point. The important files for the purpose of illustration are these:
-
composer.json
illustrates how Composer Stager is added to your application via Composer. The only really important value isrequire.php-tuf/composer-stager
. Add it to your Composer config with this command in the terminal:composer require php-tuf/composer-stager
-
config/services.yml
illustrates injecting dependencies via a service container—in this case, Symfony's. -
The command classes illustrate invoking the Composer Stager code API: