Download the PHP package hutnikau/job-scheduler without Composer

On this page you can find all versions of the php package hutnikau/job-scheduler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package job-scheduler

job-scheduler

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads

Job scheduler is a PHP library for scheduling time-based repetitive actions. It uses (RRULE) or Cron notation to configure time and recurrence rule of each job.

Goals

Sometimes amount of cron jobs becomes too large. The main goal is reduce amount of cron jobs to only one.

Installation

Via Composer

Usage

Create recurrence rule

iCalendar syntax

Cron syntax:

Get the recurrences between dates

Get the next recurrence after given date

Create a job

Job constructor have the following signature: \Scheduler\Job\Job::__construct(RRule $rRule, callable $callable);

Example: iCalendar syntax

Cron syntax:

Note: Cron syntax does not allow to limit number of occurrences.

Create Job from string using iCalendar syntax:

Create Job from string using cron syntax:

Schedule a job

Scheduler constructor accepts array of jobs as first parameter:

Run scheduled jobs

Run all jobs scheduled from '2017-12-12 20:00:00' to '2017-12-12 20:10:00':

Note: the last true parameter means that jobs scheduled exactly at from or to time will be included. In this example it means that jobs scheduled to be run at '2017-12-12 20:00:00' or '2017-12-12 20:10:00' will be executed.

$jobRunner->run(...) returns an array of reports (\Scheduler\Action\Report)

Workers

Worker is supposed to be run continuously and check with defined period if there are jobs to be executed.

Worker above will make two iterations (checks if there is a job to execute) with an interval of one minute. Default amount of iterations is 1000.

Action inspectors

In order to be able to run two or more workers on different servers or to avoid execution of one job twice action inspectors may be used:

Currently there is also Rds implementation so all the performed actions data can be stored in SQL storage. Constructor of expects to receive \Doctrine\DBAL\Connection instance:

Note: Make sure you prepared the database (created the table) using initDb static method:

Reports

\Scheduler\Action\Report class synopsis:

In case if during execution an exception has been thrown then this exception will be returned as a result of action.

$report->getType() returns one of two values: \Scheduler\Action\Report::TYPE_SUCCESS | \Scheduler\Action\Report::TYPE_ERROR

Warnings

  1. Be careful with timezones. Make sure that you create \DateTime instances with correct timezone.
  2. Accuracy of scheduler up to seconds. You must be accurate with $from, $to parameters passed to the runner to not miss an action or not launch an action twice (alternatively use action inspectors).
  3. Use \Scheduler\Job\CronRule implementation in case if number of occurrences is not limited.
  4. \Scheduler\Job\RRule implementation is more flexible but in case of large or unlimited number of repeats there may be performance issues. By default limit of \Scheduler\Job\RRule implementation is 732 repeats. More information: https://github.com/simshaun/recurr

Testing

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of job-scheduler with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
simshaun/recurr Version ~3.0.0
mtdowling/cron-expression Version ~1.2.0
jeremeamia/superclosure Version ^2.0
doctrine/dbal Version ~2.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hutnikau/job-scheduler contains the following files

Loading the files please wait ....