Effigy is a globally installed universal CLI tool for easily running tasks in your application.
This package requires PHP 8.4 or higher.
Install via Composer:
composer global require decodelabs/effigyYou will also need to have added your global composer installation bin directory to your $PATH in your ~/.bash_profile or ~/.bashrc file:
export PATH=~/.config/composer/vendor/bin:$PATHNote, earlier versions of composer may store global config in ~/.composer/vendor/bin - adapt your $PATH as necessary. You can find composer's home path with composer global config home
Effigy can be used to simplify running tasks in your project from the command line. Its primary job is to locate and load the main entry point to your project via a globally installed executable.
Say for example, you currently run commands in your project though webroot/index.php as your primary entry point:
php webroot/index.php run-taskDefine your entry point in your composer.json file:
{
"extra": {
"effigy": {
"entry": "webroot/index.php"
}
}
}Then you can run CLI commands available in your project via the effigy executable directly:
effigy run-taskShould you need per-environment entry files, specify template keys in your composer config:
{
"extra": {
"effigy": {
"entry": "entry/{{env}}.php"
}
}
}Then on first run, Effigy will ask for the "env" parameter and save it in a local config file (which gets added to your .gitignore).
If you don't want to install Effigy globally, you can use it as a local executable in your project.
composer require decodelabs/effigy
vendor/bin/effigy install-localYou can then call effigy like so:
./effigy run-taskEffigy can use alternative versions of PHP on a per-project basis:
effigy set-php
> php8.1The bin path is stored in your local config and all process launches will use this going forward. Reset it to "php" to use the default system global binary.
Effigy will attempt to run scripts defined in your composer.json:
{
"scripts": {
"analyze": "phpstan analyze"
}
}effigy analyzeYou can also run composer commands through effigy directly:
effigy composer require decodelabs/atlasThis is especially useful if you have defined an alternative version of PHP for your project as global composer will use global PHP.
Effigy is licensed under the MIT License. See LICENSE for the full license text.