/composer-stager-console

Example console commands for Composer Stager

Primary LanguagePHPMIT LicenseMIT

Example Composer Stager Console Command

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.

Warning!

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.

Console command

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

Available commands

  • 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.

Example workflow:

# 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

As an example of implementation

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: