PHP code example of proklung / framework-tools-bundle

1. Go to this page and download the library: Download proklung/framework-tools-bundle 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/ */

    

proklung / framework-tools-bundle example snippets


(new CommandRunner([
            new Process("my:command -q"),
            new Process("my:command2 -q"),
            new Process("my:command3 -q").
            new Process("my:command4 -q"),
            new Process("my:command5 -q"),
            new Process("my:command6 -q --env=$env"),
        ]))
            ->continueOnError(true)
            ->setIO($this->io)
            ->setLimit(3)
            ->run();
            

class ExampleRunner extends Command
{
    /** @var SymfonyStyle */
    protected $io;

    /**
     * @inheritDoc
     */
    protected function configure()
    {
        $this->setName('runner:example')
             ->setDescription('runner example');
    }

    /**
     * @inheritDoc
     */
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->io = new SymfonyStyle($input, $output);

        $this->io->writeln('Running runner example');

        sleep(5); # Sleep so user can abort update

        (new CommandRunner([
            new Process(['cache:clear', 'cache:clear --cache-type menu']),
        ]))
            ->continueOnError(true)
            ->setIO($this->io)
            ->setLimit(3)
            ->run();

        return 0;
    }
}

use Prokl\FrameworkExtensionBundle\Services\Command\Lockable\AbstractLockableCommand;

class SomeCommand extends AbstractLockableCommand
{
   protected function configure()
   {
       $this->setName('lock:command')
            ->setDescription('Lock command')
    
       ;
    
       parent::configure();
   }

   protected function execute(InputInterface $input, OutputInterface $output) : int
   {
        $output->writeln('Start');
        sleep(100);
        $output->writeln('End');

        return 0;
   }
}

define('SAVEQUERIES', true);

define('SAVEQUERIES', (bool)$_ENV['SAVEQUERIES'] ?? false);

$sql = container()->get('sql.logger.monolog');
$sql->init();