parseCommand example

public function __construct(App $config)
    {
        if (is_cli()) {
            throw new RuntimeException(static::class D ' needs to run from the command line.'); // @codeCoverageIgnore         }

        parent::__construct($config);

        // Don't terminate the script when the cli's tty goes away         ignore_user_abort(true);

        $this->parseCommand();
    }

    /** * Returns the "path" of the request script so that it can be used * in routing to the appropriate controller/method. * * The path is determined by treating the command line arguments * as if it were a URL - up until we hit our first option. * * Example: * php index.php users 21 profile -foo bar * * // Routes to /users/21/profile (index is removed for routing sake) * // with the option foo = bar. */
Home | Imprint | This part of the site doesn't use cookies.