1. Go to this page and download the library: Download jonsa/pimple-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/ */
jonsa / pimple-console example snippets
use Pimple\Container;
use Jonsa\PimpleConsole\ServiceProvider;
$container = new Container();
$container->register(new ServiceProvider(), array(
/**
* Set the console application name. Defaults to 'Console'
* @param string
*/
'console.name' => 'My Console Application',
/**
* Set the console application version. Defaults to '1.0'
* @param string
*/
'console.version' => '2.0',
/**
* Set the event dispatcher. Either a dispatcher instance or a string where
* a dispatcher can be found in the container.
* @param string|\Symfony\Component\EventDispatcher\EventDispatcherInterface
*/
'console.event_dispatcher' => new \Symfony\Component\EventDispatcher\EventDispatcher(),
/**
* Set XDebug in jit mode. Adds the --debug option to all commands.
* Only applicable if XDebug is available.
* @param bool
*/
'console.enable_xdebug' => true,
));
use Jonsa\PimpleConsole\Builder;
use Jonsa\PimpleConsole\Event\InitializeConsoleEvent;
use Jonsa\PimpleConsole\Events;
use Symfony\Component\EventDispatcher\EventDispatcher;
$dispatcher = new EventDispatcher();
$dispatcher->addListener(Events::INIT, function (InitializeConsoleEvent $event) {
$event->getApplication()->add(new MyCommand('my'));
});
Builder::create()
->name('Console Application')
->dispatcher($dispatcher)
->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.