1. Go to this page and download the library: Download xervice/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/ */
xervice / console example snippets
namespace App\Console;
use Xervice\Console\ConsoleDependencyProvider as XerviceConsoleDependencyProvider;
class ConsoleDependencyProvider extends XerviceConsoleDependencyProvider
{
/**
* @return array
*/
protected function getCommandList(): array
{
return [
new MyCommand()
];
}
}
namespace App\MyModule\Communication\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Xervice\Console\Business\Model\Command\AbstractCommand;
/**
* @method \App\MyModule\Business\MyModuleFacade getFacade()
* @method \App\MyModule\Communication\MyModuleCommunicationFactory getFactory()
*/
class MyCommand extends AbstractCommand
{
/**
* @throws \Symfony\Component\Console\Exception\InvalidArgumentException
*/
protected function configure(): void
{
$this
->setName('mymodule:mycommand')
->setDescription('Command description');
}
/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*
* @return int|void
* @throws \Core\Locator\Dynamic\ServiceNotParseable
*/
public function run(InputInterface $input, OutputInterface $output)
{
$this->getFacade()->runMyCommand($output);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.