Download the PHP package bayfrontmedia/cron-scheduler without Composer

On this page you can find all versions of the php package bayfrontmedia/cron-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 cron-scheduler

Cron Scheduler

A flexible framework-agnostic cron job scheduler using human-readable expressions.

License

This project is open source and available under the MIT License.

Author

Bayfront Media

Requirements

Installation

Usage

Start using Cron Scheduler

First, create a file to be used to schedule jobs, for example cron.php. The file can be named whatever you like.

Then, add a new entry to your crontab to run the file every minute:

Or, to save the output from the jobs to a log file, specify a file path, such as:

Now, your server will check the file every minute, and Cron Scheduler will only run the jobs that are due, according to their schedule.

Creating an instance

NOTE: All exceptions thrown by Cron Scheduler extend Bayfront\CronScheduler\CronException, so you can choose to catch exceptions as narrowly or broadly as you like.

The constructor accepts two parameters as strings: $lock_file_path and $output_file.

To prevent overlapping jobs, Cron Scheduler creates temporary "lock" files. These files are created for each job once it begins, and deleted once it completes. Jobs will be skipped when a lock file exists, even if it is due to run. If $lock_file_path === NULL, lock files will never be created, and all jobs will be allowed to overlap.

When an $output_file is specified, any output from the jobs that run will be saved to this file, unless a custom file is specified specifically for that job (see saveOutput). This has the same effect as specifying a log file in the crontab (see above).

The constructor may throw a Bayfront\CronScheduler\FilesystemException exception.

Example cron.php:

Public methods

Job schedule


getJobs

Description:

Return scheduled cron jobs.

Parameters:

Returns:

Example:


getPreviousDate

Description:

Get previous date a given job was scheduled to run.

Parameters:

See: https://www.php.net/manual/en/datetime.format.php

Returns:

Throws:

Example:


getNextDate

Description:

Get next date a given job is scheduled to run.

Parameters:

See: https://www.php.net/manual/en/datetime.format.php

Returns:

Throws:

Example:


run

Description:

Runs all queued jobs that are due.

Parameters:

Returns:

Throws:

The array that is returned will contain the following keys:

Throws:

Example:

Another example, this time overriding (or, "spoofing") the current time:


raw

Description:

Adds a raw command as a job.

By default, the job will run every minute.

Parameters:

Returns:

Throws:

Example:


php

Description:

Adds a php file as a job.

By default, the job will run every minute.

Parameters:

Returns:

Throws:

Example:


call

Description:

Adds a callable function as a job.

NOTE: Functions should return, not echo output.

By default, the job will run every minute.

Parameters:

Returns:

Throws:

Example:


always

Description:

Always run job, even if previous execution is still in progress.

This prevents a lock file from being created for this job.

Parameters:

Returns:

Example:


when

Description:

Add a condition for the job to run, even if it is due.

The job will only run if the return value of $callable is TRUE.

Parameters:

Returns:

Example:


saveOutput

Description:

Save the output of the job to a given file.

This will override $output_file, if specified in the constructor.

Parameters:

Returns:

Example:


at

Description:

Schedule job to run using a valid cron expression.

Parameters:

Returns:

Example:


everyMinutes

Description:

Schedule job to run every x number of minutes.

Parameters:

Returns:

Throws:

Example:


hourly

Description:

Schedule job to run on a given minute of every hour.

Parameters:

Returns:

Throws:

Example:


everyHours

Description:

Schedule job to run on the hour every x number of hours.

Parameters:

Returns:

Throws:

Example:


daily

Description:

Schedule job to run at a given time of every day.

Parameters:

Returns:

Throws:

Example:


weekly

Description:

Schedule job to run on a given weekday and time of every week.

Parameters:

Returns:

Throws:

Example:


monthly

Description:

Schedule job to run on a given day and time of every month.

Parameters:

Returns:

Throws:

Example:


everyMonths

Description:

Schedule job to run at a given time on the first day every x number of months.

Parameters:

Returns:

Throws:

Example:


annually

Description:

Schedule job to run on a given month, day and time each year.

Parameters:

Returns:

Throws:

Example:


sunday

Description:

Schedule job to run at a given time every Sunday.

Parameters:

Returns:

Throws:

Example:


monday

Description:

Schedule job to run at a given time every Monday.

Parameters:

Returns:

Throws:

Example:


tuesday

Description:

Schedule job to run at a given time every Tuesday.

Parameters:

Returns:

Throws:

Example:


wednesday

Description:

Schedule job to run at a given time every Wednesday.

Parameters:

Returns:

Throws:

Example:


thursday

Description:

Schedule job to run at a given time every Thursday.

Parameters:

Returns:

Throws:

Example:


friday

Description:

Schedule job to run at a given time every Friday.

Parameters:

Returns:

Throws:

Example:


saturday

Description:

Schedule job to run at a given time every Saturday.

Parameters:

Returns:

Throws:

Example:


january

Description:

Schedule job to run on a given day and time each January.

Parameters:

Returns:

Throws:

Example:


february

Description:

Schedule job to run on a given day and time each February.

Parameters:

Returns:

Throws:

Example:


march

Description:

Schedule job to run on a given day and time each March.

Parameters:

Returns:

Throws:

Example:


april

Description:

Schedule job to run on a given day and time each April.

Parameters:

Returns:

Throws:

Example:


may

Description:

Schedule job to run on a given day and time each May.

Parameters:

Returns:

Throws:

Example:


june

Description:

Schedule job to run on a given day and time each June.

Parameters:

Returns:

Throws:

Example:


july

Description:

Schedule job to run on a given day and time each July.

Parameters:

Returns:

Throws:

Example:


august

Description:

Schedule job to run on a given day and time each August.

Parameters:

Returns:

Throws:

Example:


september

Description:

Schedule job to run on a given day and time each September.

Parameters:

Returns:

Throws:

Example:


october

Description:

Schedule job to run on a given day and time each October.

Parameters:

Returns:

Throws:

Example:


november

Description:

Schedule job to run on a given day and time each November.

Parameters:

Returns:

Throws:

Example:


december

Description:

Schedule job to run on a given day and time each December.

Parameters:

Returns:

Throws:

Example:


All versions of cron-scheduler with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
bayfrontmedia/php-string-helpers Version ^2.0
dragonmantank/cron-expression Version 3.3.*
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 bayfrontmedia/cron-scheduler contains the following files

Loading the files please wait ....