GitHub Repository

apiato

Definition

Commands:

Principles

Rules

Folder Structure

 - app
    - Containers
        - {container-name}
            - UI
                - CLI
                    - Commands
                        - SayHelloCommand.php
                        - ...
    - Ship
        - Commands
            - GeneralCommand.php
            - ...

Code Samples

Example: a simple Command

<?php

namespace App\Containers\Welcome\UI\CLI\Commands;

use App\Ship\Parents\Commands\ConsoleCommand;

class SayWelcome extends ConsoleCommand
{

    protected $signature = 'say:welcome';

    protected $description = 'Just Saying Welcome.';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        dump('Welcome to apiato :)');
    }
}

Usage from CLI (Terminal):

php artisan say:welcome

Schedule Commands Execution

To Schedule the execution of a Command checkout the Tasks Scheduling page.

Define Consoles Routes

To define Console route go to app/Ship/Commands/Routes.php.