1. Go to this page and download the library: Download ampersa/axo 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/ */
ampersa / axo example snippets
axo
namespace Commands;
use System\Log\Log;
use System\Console\Command;
class ExampleCommand extends Command
{
/**
* Signature formats:
* COMMAND (DESCRIPTION) {--OPTION|-O} {--OPTIONAL?} {ARGUMENT} {ARGUMENT?}
* 1 2 3 4 5 6
*
* 1) The command to run this Command via run
* 2) An optional description that displays in the command list
* 3) A compulsary option, with short alias
* 4) An optional option
* 5) A compulsary argument
* 6) An optional argument
*/
protected $signature = 'example (Prints the date and time) {--timestamp|-t}
{format}
{timezone?}';
/**
* Setup the Command
* @return void
*/
public function setup()
{
// The $signature can instead be specified fluently
//
// $this->setCommand('example')
// ->setDescription('Example command - prints the date and time')
// ->
namespace Commands;
use Carbon\Carbon;
use System\Console\Command;
class ExampleCommand extends Command
{
protected $signature = 'example (Prints the date and time) {format}';
/** @var Carbon\Carbon */
protected $carbon;
public function __construct(Carbon $carbon)
{
parent::__construct();
$this->carbon = $carbon;
}
public function run(string $format)
{
$this->output('Format: '. $format);
$this->output($this->carbon->now()->format($format));
}
}
// Init a progress bar
// Pass the upper limit of the progress as the first argument
$this->progressBar(10);
// Set a title
$this->setProgressBarTitle('Progress...');
// Set a message to display on completion
$this->setProgressBarCompleteMessage('Completed task');
// Begin
$this->startProgressBar();
for ($number = 0; $number < 10; $number++) {
// Increment the progress bar
$this->advanceProgressBar();
// Or, advance by multiple
// $this->advanceProgressBar(2);
// Alternatively, set the progress manually
// $this->setProgressBar(5);
}
// Mark the progress bar as complete
$this->completeProgressBar();
$ php axo new ProcessCommand process --description="Process a file"