1. Getting Started¶
1.1. Requirements¶
PhpZone requires PHP 5.3 or higher.
1.2. Installation¶
Installation is provided via Composer, if you don’t have it, do install:
$ curl -s https://getcomposer.org/installer | php
then PhpZone Shell can be added into your dependencies by:
$ composer require --dev phpzone/shell 0.2.*
or add it manually into your composer.json
:
{
"required-dev": {
"phpzone/shell": "0.2.*"
}
}
1.3. Configuration file¶
If the configuration file doesn’t exist yet, you can find more information in PhpZone - Getting Started
1.3.1. Registration of the extension¶
Registration is provided by a simple definition of full name of the class (namespace included):
extensions:
PhpZone\Shell\Shell: ~
Note
This extension is a command builder with definitions within its values. It means that only the registration without any values would have no effect.
1.3.2. Creating of commands¶
As mentioned in the PhpZone documentation, each extension gets its configuration via values which are defined during its registration. PhpZone Shell expects to get an array of required commands. Each command has defined its name as a key and its values are definitions for exact command:
extensions:
PhpZone\Shell\Shell:
'command:one':
script:
- echo Command 1 is working
'command:two':
script:
- echo Command 2 is working
Now, when we would run:
$ vendor/bin/phpzone command:one
we would see an output: Command 1 is working