PHP code example of marrios / firulincore

1. Go to this page and download the library: Download marrios/firulincore library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marrios / firulincore example snippets




namespace Firulin\Commands;

use Firulin\Messages\MessageNormal;
use Firulin\Messages\MessageSuccess;
use Firulin\Messages\MessageError;

class Hello extends Command
{
    //
    public function world()
    {
        echo "Hello World";
    }
}


    /**
     *  Before creating a new command, you must add it 
     *  to the "commands" array, and to the "suggestList" array
     */
   
    "commands"=>[
        //Command
        "project"=>[
            // SubCommand
            "create"
        ],
        "cmd"=>[
            "create"
        ],
        "hello"=>[
            "world"
        ]
    ]


    /**
     * Command suggestion list
     */
    "suggestList"=>[
        "project",
        "cmd",
        "hello"
    ],

Use Firulin\Captain;
use Firulin\Commands\Command;
use Firulin\Commands\Project;
use Firulin\Commands\Cli;
//
use Firulin\Commands\Hello;


    /**
     * command switch
     */
    switch ($command->type) {
        case 'project':
            $captain->execute(Project::class, $command);                
            break;
        case 'cmd':
            $captain->execute(Cli::class, $command);                
            break;
        case 'hello':
            $captain->execute(Hello::class, $command);                
            break;
    }
bash
    php firulin cmd:create Hello