PHP code example of meritum / sage

1. Go to this page and download the library: Download meritum/sage 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/ */

    

meritum / sage example snippets


namespace App\Command;

use Meritum\Cli\ExitCode;
use Meritum\Cli\Command\Command;
use Meritum\Cli\Output\SageStyleInterface;

final class HelloCommand extends Command
{
    public function __invoke(SageStyleInterface $io): ExitCode
    {
        $io->success('Hello, world!');

        return ExitCode::Success;
    }
}

use Meritum\Cli\CliKernelOption;

$kernel->define(HelloCommand::class, function (): HelloCommand {
    $command = new HelloCommand();
    $command->setName('hello')->setDescription('Say hello');
    return $command;
})->tag(CliKernelOption::CommandTag->value);
bash
php bin/sage
bash
composer install
php bin/sage

bin/sage                  Entry point
src/
  ModuleRepository.php    Register application modules
  AppModule.php           Register commands and application config
tests/
devenv.nix                Dev environment