PHP code example of attreid / console

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

    

attreid / console example snippets


class RouterFactory
    public function __construct(private readonly \Attreid\Console\Routing\RouterFactory $consoleRouterFactory)
	{
	}

	public function createRouter(): RouteList
	{
		$router = new RouteList;
		$this->consoleRouterFactory->createRoutes($router);
		// other routes
}

class ClassWithCommands extends CommandCollection {

    /**
     * Comment, show in help
     * @param string $variable comment 
     */
    public function command(string $variable): void {
        $this->printLine('Some info');
        // php code
    }
}
bash
php index.php ClassWithCommands:command /variable=value