1. Go to this page and download the library: Download boboldehampsink/cronjob 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/ */
boboldehampsink / cronjob example snippets
$crontabRepository = new Cronjob_RepositoryModel(new Cronjob_AdapterModel());
$cronjob = new CronjobModel();
$cronjob->minutes = '30';
$cronjob->hours = '23';
$cronjob->dayOfMonth = '*';
$cronjob->months = '*';
$cronjob->dayOfWeek = '*';
$cronjob->taskCommandLine = 'df >> /tmp/df.log';
$cronjob->comments = 'Logging disk usage'; // Comments are persisted in the crontab
$crontabAdapter = new Cronjob_AdapterModel();
$crontabRepository = new Cronjob_RepositoryModel($crontabAdapter);
$crontabRepository->addJob($cronjob);
$crontabRepository->persist();