PHP code example of initphp / console
1. Go to this page and download the library: Download initphp/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/ */
initphp / console example snippets
#!/usr/bin/env php
plication, Input, Output};
$console = new Application("My Console Application", '1.0');
// Register commands ...
// hello -name=John
$console->register('hello', function (Input $input, Output $output) {
if ($input->hasArgument('name')) {
$output->writeln('Hello {name}', [
'name' => $input->getArgument('name')
]);
} else {
$output->writeln('Hello World!');
}
}, 'Says hello.');
$console->run();
php console.php list