drunomics / phapp-cli
Provides standardized console commands for PHP applications.
Requires
- php: >=7.4
- consolidation/robo: ^5
- consolidation/self-update: ^2.0
- cweagans/composer-patches: ^1.7
- symfony/dotenv: ^7
- symfony/event-dispatcher: ^7
- symfony/yaml: ^6
Requires (Dev)
- dev-master
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.6.0-beta10
- 0.6.0-beta9
- 0.6.0-beta8
- 0.6.0-beta7
- 0.6.0-beta6
- 0.6.0-beta5
- 0.6.0-beta4
- 0.6.0-beta3
- 0.6.0-beta2
- 0.6.0-beta1
- 0.5.0
- 0.5.0-beta2
- 0.5.0-beta1
- 0.4.0
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.2
- dev-feature/LDP-2618-1
- dev-dependabot/composer/symfony/process-6.4.14
- dev-feature/INF-477
- dev-renovate/configure
- dev-feature/LDP-1130
This package is auto-updated.
Last update: 2024-12-02 13:09:10 UTC
README
Provides standardized console commands for PHP applications.
Requirements
- Git version >= 2.0
- Bash 4.*
- PHP >5.6|>7.0
Installation
Installation requires composer. As there are some dependency conflicts with the latest drush release it is recommended to install the tool via consolidation/cgr. To do so, just execute:
# Download latest stable release.
php -r "
ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)');
readfile(json_decode(file_get_contents('https://api.github.com/repos/drunomics/phapp-cli/releases/latest'))->assets[0]->browser_download_url);
" > phapp
chmod +x phapp
# Optional: Ensure ~/bin exists and configure it to be available in $PATH.
[ -d ~/bin ] || mkdir ~/bin
echo $PATH | grep -q ~/bin || (echo "export PATH=~/bin:\$PATH" >> ~/.bashrc && export PATH=~/bin:$PATH)
# Make phapp executable from everywhere by moving to a destination available in $PATH.
# If you skipped the optional step above, be sure to move it to a suiting destination.
mv phapp ~/bin/phapp
Updating
Run
phapp self:update
Usage
Run phapp list
to show a list of support commands and use phapp command --help
for more information about a command. The list of currently available commands
is:
build Builds the project with the current code checkout.
clone Clones a Phapp project.
create Creates a new project base on a given template.
help Displays help for a command
init Initializes the app.
install Installs the application.
list Lists commands
setup Setups the phapp environment.
status Checks for a working and installed application.
update Updates the app.
build
build:branch Builds a given branch.
build:clean Cleans all build related files.
git
git:pull Updates local branches by pull from remote repositories.
git:setup-remotes Configures Git remote repositories.
init
init:manifest Initializes a new phapp.yml for your project.
self
self:update Updates the installed phar.
phapp.yml
An application provides basic metadata and customizes commands in its
phapp.yml
, the phapp manifest. See examples/phapp.yml
for an example.
Phapp environment variables
Commands defined in phapp.yml
may make use of the phapp environment
variables.
Dotenv support
Phapp environment variables are either set by the environment; i.e. the host, or via a .env file.
In order to help with initializing the environment based upon one or multiple
.env files the environment
command may be used. This command is prepended the
other commands (except setup) such that they may rely on the initialized
environment.
Thus, the .env file can be written as part of the setup
command and sourced
as part of the environment
command.
Available variables
Available environment variables are / must be:
Optional environment variables are:
Database connection.
PHAPP_ENV_MYSQL_DEFAULT_DATABASE=database
PHAPP_ENV_MYSQL_DEFAULT_USERNAME=user
PHAPP_ENV_MYSQL_DEFAULT_PASSWORD=pass
PHAPP_ENV_MYSQL_DEFAULT_HOST=localhost
PHAPP_ENV_MYSQL_DEFAULT_PORT="3306"
Various other variables provided by the environment.
PHAPP_ENV_DUMP_DIR="/data/mysql_dumps/sync"
PHAPP_ENV_DUMP_DB_FILENAME="${PHAPP_ENV_MYSQL_DEFAULT_DATABASE}-$(date -d "1 day ago" +%Y%m%d).sql.gz"
Phapp development
Build a new phar
The phar is built using box, for details see https://github.com/box-project/box. To built the phar just run:
composer install --dev
composer build
Create a new release
- Tag a new version and push it.
- Build a new phar (see above).
- Upload the new phar at the github release page. Keep the filename as is.
- Note that the packagist API is not updated immediately. Thus it takes a few minutes until the new release is picked up by the self:update command.