Alice is a modular command line framework, It can help with deploying websites, building skeleton projects fast, creating Cron's and defining and running command chains. This can be found on github.
You can install this using the composer create-project command,
create-project danzabar\alice directory
Once the composer install is finished, check the configuration files, theres are located in the
config/ directory, make sure the database details are correct then run this command
php alice install
This will install the relevent database tables to make proper use of Alice.
So we have installed, and we have tables, what else can we do with this?
Alice makes it easy to define and create skeleton projects, first thing we need to do is define a build script. These must be located in the
/config/skeletons/ directory, lets pretend we have this file there:
config/skeletons/laravel.yml ## This will be our laravel skeleton project build_script: - composer create-project laravel/laravel [directory] - cd [directory] && git init
Whenever this is ran we will create a laravel installation and init a git repo there. We can run this by using this command:
php alice skeleton:build laravel.yml directory
Ok, we have a skeleton project, so what about adding a deployment script to it so Alice can deploy the finished project? Using the same file we created for the laravel skeleton, we add this:
config/skeletons/laravel.yml build_script: - composer create-project laravel/laravel [directory] - cd [directory] && git init deploy_script: - git clone [git] [directory] - composer update - php artisan migrate:install - php artisan migrate - php artisan db:seed
Now we can run the deploy command and Alice will clone the git hub repo we give it, update composer and run the basic laravel database commands.
php alice skeleton:deploy laravel.yml directory --git="giturl"
Alice allows you to define command chains that you use often and run them in one command, to get started you have to define a command first by running:
php alice command:create name
You will be prompted to specify your commands. Once you have done this you can run that command chain by using this command:
php alice command:run name directory
The directory argument is optional, as you can specify it as a parameter when defining the command chain.
Alice has commands that let you interact with crontab on your system. There is a table that relates to these cron jobs so you can edit and remove/update them easier. Some usage examples of this:
## creating a cron php alice cron:create name "* * * * *" --cmd="" --commandlist=""
Notice that you can use a command chain in the cron job, if you are doing this then the
--commandlist option just requires the name of the command
## Updating the cron list php alice cron:update
Useful if your cron jobs have been delete from the crontab file. This writes cron jobs from the database into the crontab file.
## Edit a cron job php alice cron:edit name --time="" --cmd="" --commandlist=""
## Remove a cron job php alice cron:remove name
You can add custom modules to alice, which allow you to extend the functionality without having to mess with the core, this is recommended as it allows you to update alice without spoiling work previously done. To begin with this alice has some workshop commands to create modules within your alice install:
php alice module:make modname
This will create a module in the
workshop/ directory. For more documentation on modules, see the github docs folder.