PHP code example of job-runner / symfony-console-adapter

1. Go to this page and download the library: Download job-runner/symfony-console-adapter 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/ */

    

job-runner / symfony-console-adapter example snippets




declare(strict_types=1);

use JobRunner\JobRunner\Job\CliJob;
use JobRunner\JobRunner\Job\JobList;
use JobRunner\JobRunner\CronJobRunner;
use JobRunner\JobRunner\SymfonyConsole\SymfonyConsoleEventListener;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;

e'));
        $jobCollection->push(new CliJob('php ' . __DIR__ . '/titi.php', '1 1 1 1 1', 'hehe'));
        $jobCollection->push(new CliJob('php ' . __DIR__ . '/arg.php', '* * * * *'));

        $section = $output->section();

        CronJobRunner::create()
            ->withEventListener(new SymfonyConsoleEventListener($section, new Table($section)))
            ->run($jobCollection);

    })
    ->run();