{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Brood Console","type":"basic","slug":"misc-brood-console","excerpt":"","body":"# Brood Console\n\nWe have a console tool called \"brood\" that provides scaffolding, database migrations and many more.\n\n\n## Basic Usage\n\nTo execute a command, go to your project folder and run this console command:\n\n```shell\n$ php brood\n```\n\nIt should show a lists of commands like this\n\n```shell\nBrood (c) Daison Cariño version v1.3.0\n\nUsage:\n  command [options] [arguments]\n\nOptions:\n  -h, --help            Display this help message\n  -q, --quiet           Do not output any message\n  -V, --version         Display this application version\n      --ansi            Force ANSI output\n      --no-ansi         Disable ANSI output\n  -n, --no-interaction  Do not ask any interactive question\n  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output,                                                                                                                                                  2 for more verbose output and 3 for debug\n\nAvailable commands:\n  env              Get current environment\n  help             Displays help for a command\n  list             Lists commands\n  optimize         Compile all the classes in to a single file.\n  run              Automated scripts to be run.\n  serve            Serve the application on the PHP development server\n app\n  app:controller   Generate a new controller\n  app:module       Generate a new module\n  app:route        Generate a new route group\n clear\n  clear:all        Clear all listed\n  clear:cache      Clear the storage/cache folder\n  clear:compiled   Clear the compiled classes\n  clear:logs       Clear the storage/logs folder\n  clear:session    Clear the storage/session folder\n  clear:views      Clear the storage/views folder\n db\n  db:create        Create a new migration\n  db:migrate       Migrate the database\n  db:rollback      Rollback the last or to a specific migration\n  db:seed:create   Create a new database seeder\n  db:seed:factory  Seed based on the factories\n  db:seed:run      Run database seeders\n  db:status        Show migration status\n mail\n  mail:inliner     Inline templates to make it suitable for emails\n make\n  make:collection  Create a new collection\n  make:console     Generate a new console\n  make:model       Generate a database model\n queue\n  queue:worker     Generalized Queue Worker\n vendor\n  vendor:publish   Publish a vendor package\n```\n\n# Creating Console\n\nYou can create your own console command by executing this to your console\n\n```shell\n$ php brood make:console <name>\n```\n\nThis command generates a ***php*** class file, located at ``project-name/components/Console/<name>.php\n\nIn your class, there is ``$name`` and ``$description``, change it to allow brood to organize the commands, register your console located at ``project-name/config/consoles.php``.\n\nRun ``php brood``, the assigned ``$name`` must be listed there.\n\n\n---\n\n\n# Slash\n\nThis handles the calls when executing your console\n\n\n---\n\n\n# Arguments\n\nThis part requires an argument to be passed in, let's assume running ``php brood make:console <name>`` means having the ``<name>`` as an argument.\n\nThe sample in the generated has a multidimensional array, so you can have multiple arguments to be called.\n\nThe inside array's first index is the **title** you want to describe, and to get the inserted value you should call ``$this->input->getArgument('title');``\n\nThe array's second index is the mode of the argument, you can check the lists of available mode\n\n| Model                    | Value                                                                                                              |\n|--------------------------|--------------------------------------------------------------------------------------------------------------------|   \n| InputArgument::REQUIRED  | The argument is required                                                                                           |\n| InputArgument::OPTIONAL  | The argument is optional and therefore can be omitted                                                              |\n| InputArgument::IS_ARRAY  | The argument can contain an indefinite number of arguments and must be used at the end of the argument list        |\n\nThe array's third index is the argument's description\n\n\n---\n\n\n# Options\n\nThis part is an optional to passed in, most commands has double slashes such as ``--help`` or ``--verbose`` those are the options calls.\n\nThe sample in the generated has the same multidimensional array, which you could also have a multi options to be called.\n\nThe inside array's first index is the **title** as well which will be triggered when calling ``--<title>``, to get the passed value once the command executed, you could call this ``$this->input->getOption('title');``\n\nThe second index is the shortcut, maybe you wan't to make it as **t** that refers as the **title**.\n\nThe third index is the option, below is the lists of available options\n\n| Option                          |   Value                                                                             |\n|---------------------------------|-------------------------------------------------------------------------------------|\n| InputOption::VALUE_IS_ARRAY     |   This option accepts multiple values (e.g. --dir=/foo --dir=/bar)                  |\n| InputOption::VALUE_NONE         |   Do not accept input for this option (e.g. --yell)                                 |\n| InputOption::VALUE_REQUIRED     |   This value is required (e.g. --iterations=5), the option itself is still optional |\n| InputOption::VALUE_OPTIONAL     |   This option may or may not have a value (e.g. --yell or --yell=loud)              |\n\nThe fourth is the description of your option\n\nand The fifth by default is ``null`` which you could pass a value\n\n\n---\n\n\n# Explanation and Reference\n\nWe simplified the process of creating a console, as reference you can still review the library we used, the Symfony Console Component.\n\n***Link:*** [http://symfony.com/doc/current/components/console/introduction.html](http://symfony.com/doc/current/components/console/introduction.html)","updates":[],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"56e27116e2ee8a0e00f3ef95","__v":14,"category":{"sync":{"isSync":false,"url":""},"pages":["56e27116e2ee8a0e00f3ef95","56e27128e2ee8a0e00f3ef97","56e271308d79b50e0031d90b","56e2713ae2ee8a0e00f3ef99"],"title":"Miscellaneous","slug":"miscellaneous","order":5,"from_sync":false,"reference":false,"_id":"56c4284ad1f6d91700d3697e","__v":4,"project":"56c111095abfe40d00be875a","createdAt":"2016-02-17T07:59:06.843Z","version":"56c111095abfe40d00be875d"},"githubsync":"","createdAt":"2016-03-11T07:17:42.371Z","project":"56c111095abfe40d00be875a","version":{"version":"1.3.0","version_clean":"1.3.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["56c1110a5abfe40d00be875e","56c413a254b6030d00ec299d","56c4275048213b1700af6e33","56c42826c0c4630d004e86cb","56c4282cbc41330d009f2607","56c4284ad1f6d91700d3697e","56e271c195d1c60e00a969ee"],"_id":"56c111095abfe40d00be875d","releaseDate":"2016-02-14T23:43:05.566Z","__v":7,"createdAt":"2016-02-14T23:43:05.566Z","project":"56c111095abfe40d00be875a"},"parentDoc":null,"user":"56c1105874f0b417004baadc"}
# Brood Console We have a console tool called "brood" that provides scaffolding, database migrations and many more. ## Basic Usage To execute a command, go to your project folder and run this console command: ```shell $ php brood ``` It should show a lists of commands like this ```shell Brood (c) Daison Cariño version v1.3.0 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands: env Get current environment help Displays help for a command list Lists commands optimize Compile all the classes in to a single file. run Automated scripts to be run. serve Serve the application on the PHP development server app app:controller Generate a new controller app:module Generate a new module app:route Generate a new route group clear clear:all Clear all listed clear:cache Clear the storage/cache folder clear:compiled Clear the compiled classes clear:logs Clear the storage/logs folder clear:session Clear the storage/session folder clear:views Clear the storage/views folder db db:create Create a new migration db:migrate Migrate the database db:rollback Rollback the last or to a specific migration db:seed:create Create a new database seeder db:seed:factory Seed based on the factories db:seed:run Run database seeders db:status Show migration status mail mail:inliner Inline templates to make it suitable for emails make make:collection Create a new collection make:console Generate a new console make:model Generate a database model queue queue:worker Generalized Queue Worker vendor vendor:publish Publish a vendor package ``` # Creating Console You can create your own console command by executing this to your console ```shell $ php brood make:console <name> ``` This command generates a ***php*** class file, located at ``project-name/components/Console/<name>.php In your class, there is ``$name`` and ``$description``, change it to allow brood to organize the commands, register your console located at ``project-name/config/consoles.php``. Run ``php brood``, the assigned ``$name`` must be listed there. --- # Slash This handles the calls when executing your console --- # Arguments This part requires an argument to be passed in, let's assume running ``php brood make:console <name>`` means having the ``<name>`` as an argument. The sample in the generated has a multidimensional array, so you can have multiple arguments to be called. The inside array's first index is the **title** you want to describe, and to get the inserted value you should call ``$this->input->getArgument('title');`` The array's second index is the mode of the argument, you can check the lists of available mode | Model | Value | |--------------------------|--------------------------------------------------------------------------------------------------------------------| | InputArgument::REQUIRED | The argument is required | | InputArgument::OPTIONAL | The argument is optional and therefore can be omitted | | InputArgument::IS_ARRAY | The argument can contain an indefinite number of arguments and must be used at the end of the argument list | The array's third index is the argument's description --- # Options This part is an optional to passed in, most commands has double slashes such as ``--help`` or ``--verbose`` those are the options calls. The sample in the generated has the same multidimensional array, which you could also have a multi options to be called. The inside array's first index is the **title** as well which will be triggered when calling ``--<title>``, to get the passed value once the command executed, you could call this ``$this->input->getOption('title');`` The second index is the shortcut, maybe you wan't to make it as **t** that refers as the **title**. The third index is the option, below is the lists of available options | Option | Value | |---------------------------------|-------------------------------------------------------------------------------------| | InputOption::VALUE_IS_ARRAY | This option accepts multiple values (e.g. --dir=/foo --dir=/bar) | | InputOption::VALUE_NONE | Do not accept input for this option (e.g. --yell) | | InputOption::VALUE_REQUIRED | This value is required (e.g. --iterations=5), the option itself is still optional | | InputOption::VALUE_OPTIONAL | This option may or may not have a value (e.g. --yell or --yell=loud) | The fourth is the description of your option and The fifth by default is ``null`` which you could pass a value --- # Explanation and Reference We simplified the process of creating a console, as reference you can still review the library we used, the Symfony Console Component. ***Link:*** [http://symfony.com/doc/current/components/console/introduction.html](http://symfony.com/doc/current/components/console/introduction.html)