chriha / project-cli
Requires
- php: ^7.2
- ext-curl: *
- ext-intl: *
- ext-json: *
- ext-xml: *
- guzzlehttp/guzzle: ^6.3
- illuminate/container: ^5.8
- illuminate/support: ^5.8
- phlak/semver: ^2.0
- psr/log: ^1.1
- sensiolabs/security-checker: ^6.0
- symfony/console: ^4.3
- symfony/dotenv: ^4.3
- symfony/event-dispatcher: ^4.3
- symfony/process: ^4.3
- symfony/var-dumper: ^4.3
- symfony/yaml: ^4.3
README
ProjectCLI is a command line tool that translates complex tasks into simple, single commands. It also helps keeping a standard project structure across all projects. Here are some benefits of using ProjectCLI:
- Initialize, setup and start whole environments (incl. web server, database, caching, mail server, etc.) in seconds
- Set up even complex projects with a single command
- Use (force) the same directory structure in every project
- Reduce amount of necessary commands for each developer
- The same environment, tools and versions for every developer
- Easier and colored log-tailing
- Write your own commands and plugins to extend ProjectCLI
- Simple
/etc/hosts
and SSH config management
For the plugin registry, more info, the documentation and some examples, check out cli.lazu.io.
TOC
Getting Started
Prerequisites
- PHP CLI 7.2 or newer (incl. extensions: zlib, json, intl, xml, curl)
Install dependencies via Homebrew
$ brew install php@7.2
Install dependencies on Ubuntu
Make sure the available version meets the requirements:
$ apt show php
If not, add the following repository:
$ add-apt-repository -y ppa:ondrej/php && apt-get update
Install the PHP CLI and extensions:
$ apt install php-cli php-xml php-curl php-zip php-intl php-json
Install ProjectCLI
After you've installed all dependencies, get the latest ProjectCLI release here and move it to /usr/local/bin/project
or /usr/bin/project
, depending on your system. The project
command will be available after you restart your terminal session.
Update
To manually update ProjectCLI, just use the project self-update
command.
Usage
It's mandatory, that the project has the according directory structure and files in order for ProjectCLI to work properly.
Project Structure
- commands
| Contains project specific commands, created via 'project make:command'
- conf
| Add configuration files for components (like nginx, PHP, crontab, supervisor, etc)
- scripts
| Can contain scripts for deployment, HTTP requests or other complex tasks
- src
| Contains the application src
- temp
| Directory for temporary files, such as docker-compose service mounts
Create a new project
project create NAME [--type=php|node|python] [--repository=URL_TO_YOUR_REPOSITORY]
Clone and automatically install existing projects
To create an automated setup for an existing project, you need to add a setup
command via
project make:command SetupCommand
. In the handle()
method, you specify the commands to set up
the project (eg. copy env files, run migrations, seed test data, compile static files, etc).
project clone REPOSITORY_URL [DIRECTORY]
The clone
command will clone the repository and ask, if the project should be set up via the
existing setup
command.
Start and stop environment and its services
project [up|down|restart]
Run any service specific command
ProjectCLI will run all commands inside the according Docker service.
# for the web service project [artisan|composer|...] # for node / npm / npx project [node|npm|npx install|run|...]
Show service status and resource statistics
project help status
Logging
Find all your log files and see what's happening with your application. It'll also warn you, if your files get too big.
project help logs:tail
Xdebug
Enable and disable Xdebug with a single command.
project help php:xdebug
Hosts File
List, enable, disable, add, remove and check hosts for existence
project help hosts
Whenever you change the hosts file (eg. enable, disable, add, rm), you have to run the command with sudo / as root.
ProjectCLI will create backups, but only keeps the last two versions.
Docker commands
Run Docker Compose commands with your docker-compose.yml
project help docker:compose
Using bash inside a container / service
project help shell
Uninstall
rm -rf $HOME/.project $(which project)