1. Go to this page and download the library: Download innmind/cron 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/ */
innmind / cron example snippets
use Innmind\Cron\{
Crontab,
Job,
};
use Innmind\OperatingSystem\Factory;
$os = Factory::build();
$install = Crontab::forConnectedUser(
Job::of('* * * * * say hello'),
Job::of('*/2 * * * * say world'),
);
$install($os->control());
// this is the same as running "echo '* * * * * say hello' | crontab" in your terminal
use Innmind\Cron\{
Crontab,
Job,
};
use Innmind\OperatingSystem\Factory;
use Innmind\Server\Control\ScriptFailed;
use Innmind\Immutable\{
Either,
SideEffect,
};
$os = Factory::build();
$install = Crontab::forUser(
'watev',
Job::of('* * * * * say hello'),
);
$install($os->control()); // Either<ScriptFailed, SideEffect>
// this is the same as running "echo '* * * * * say hello' | crontab -u admin" in your terminal
use Innmind\Cron\{
Crontab,
Job,
};
use Innmind\OperatingSystem\Factory;
use Innmind\Url\Url;
$os = Factory::build();
$install = Crontab::forUser(
'admin',
Job::of('* * * * * say hello'),
);
$install(
$os->remote()->ssh(Url::of('ssh://example.com')),
);
use Innmind\Cron\{
Read,
Job,
};
use Innmind\OperatingSystem\Factory;
use Innmind\Immutable\{
Maybe,
Sequence,
};
$os = Factory::build();
$read = Read::forConnectedUser();
$jobs = $read($os->control()); // it will run "crontab -l"
// $jobs is an instance of Maybe<Sequence<Job>>
use Innmind\Cron\{
Read,
Job,
};
use Innmind\OperatingSystem\Factory;
use Innmind\Immutable\{
Maybe,
Sequence,
};
$os = Factory::build();
$read = Read::forUser('watev');
$jobs = $read($os->control()); // it will run "crontab -u watev -l"
// $jobs is an instance of Maybe<Sequence<Job>>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.