PHP code example of stuntrocket / rover

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

    

stuntrocket / rover example snippets




use Rover\Plugin\BasePlugin;

class MyPlugin extends BasePlugin
{
    public function boot(): void
    {
        $this->name = 'my-plugin';
        $this->version = '1.0.0';
        $this->description = 'Custom plugin for my project';

        // Register commands
        $this->registerCommand(MyPluginCommands::class);

        // Register hooks
        $this->registerHook('before_command', function($data) {
            $this->log('Command executing...');
        });
    }
}



use Rover\Robo\Plugin\Commands\BaseCommand;
use Robo\Result;

class MyPluginCommands extends BaseCommand
{
    /**
     * @command my-plugin:hello
     */
    public function hello(string $name = 'World'): Result
    {
        $this->io()->success("Hello, $name!");

        // Use BaseCommand utilities
        if ($this->isLaravelProject()) {
            $version = $this->getLaravelVersion();
            $this->io()->note("Laravel $version detected");
        }

        return Result::success($this);
    }
}
bash
vendor/bin/robo rover:test:file tests/Feature/UserTest.php