PHP code example of hydrakit / console

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

    

hydrakit / console example snippets


use Hydra\Console\Commands\MakeClassCommand;

final class MakeControllerCommand extends MakeClassCommand
{
    protected function nameHint(): string { return 'The controller name'; }
    protected function suffix(): string   { return 'Controller'; }
    protected function stub(string $class): string { /* app-namespaced body */ }
}

$application->addCommands([
    new KeyGenerateCommand(__DIR__ . '/../.env'),
    new RouteCacheCommand($container->get(RouteCache::class), AppServiceProvider::CONTROLLERS),
    new RouteCacheClearCommand($container->get(RouteCache::class)),
    new MakeMigrationCommand(__DIR__ . '/../database/migrations'),
    // ...app-specific generators (make:controller, make:ability, make:user)
]);

$application->setCommandLoader(new FactoryCommandLoader([
    'migrate:run'    => static fn () => new MigrateRunCommand($container->get(MigrationRunner::class)),
    'migrate:fresh'  => static fn () => new MigrateFreshCommand($container->get(MigrationRunner::class), $debug),
    'migrate:status' => static fn () => new MigrateStatusCommand($container->get(MigrationRunner::class)),
]));