Download the PHP package garethellis/crontab-schedule-generator without Composer

On this page you can find all versions of the php package garethellis/crontab-schedule-generator. 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 crontab-schedule-generator

Crontab Schedule Generator

Latest Version on Packagist Total Downloads

A simple PHP library for generating Crontab schedules with expressive PHP code.

Install

Install with Composer:

Usage

I wrote this library for use with Jobby, but it could be used in any situation where you need to output a Crontab schedule with PHP.

I recommend using the included functions for expressive code.

Hourly

The Hourly class can be used to output crontab schedules to be run on an hourly basis. The hourly() function can be used to create a new instance of Hourly.

If you call hourly() by itself, you'll get a crontab schedule of "run hourly on the hour". You can specify the minutes past the hour to run at by using the at() method. This method takes either a numeric string (0-59) or one of the following text strings: on the hour, quarter past, half past or quarter to.

You can use the repeatingAt method to run a task multiple times in an hour. This method takes the same argument as at(), i.e. a numeric string (0-59) or a text string from the above list.

Daily

The Daily class can be used to output crontab schedules to be run on a daily basis. The daily() function returns a new instance of Daily.

If you call daily() by itself, you will get a crontab schedule of "run daily at midnight". You can specify a time to run using the at() method. This method takes a (string) time in 24 hour format as its only argument (e.g. "16:00").

There is also the repeatingAt() method if you would like to schedule a task to run multiple times in a day. This method takes a whole number (numeric string) as its only argument; this number represents the hour to repeat the job at. Note, this will create a schedule which repeats at the same number of minutes past the hour as whatever you specify using the at() method. It's not possible (currently) to do something like "run at 9:30, then repeat at 11:15, then repeat at "13:40".

Weekly

The Weekly class can be used to output crontab schedules to be run on a daily basis. The weekly() function returns a new instance of Weekly.

If you call weekly() by itself, you will get a crontab schedule for midnight Sunday. You can specify a day to run on using the on() method. This method takes a day name in English (e.g. 'Sunday') as its only argument. If you call it like this, you will get a crontab schedule set to run on that given day at midnight. You can specify a time to run in the same way as the Daily class - see above.

You can also set weekly schedules to repeat on given days using the repeatingOn() method, passing in a day name.

Monthly

The Monthly class allows you to output crontab schedules to be run on a monthly basis. The monthly() function returns a new instance of Monthly.

Calling monthly() by itself will give you a crontab schedule for midnight on the first of the month. To specify a day to run on, you can use an ordinal or whole number (as a numeric string) with the on() method. You can also use the at() method in the same way as with weekly & daily.

Every X minutes/Every X hours

The Interval class allows you to output crontab schedules to be run every X minutes or every X hours. This class can be instantiated using the factory function every(). Unlike the other classes in this library, this class is no good on its own, i.e. every("5") will not output anything. Instead, you have to use the minutes() and hours() methods to create instances of MinutesInterval and HoursInterval respectively. From here, usage of these classes is very similar to the above. With HoursInterval you can specify a start and stop time using the from() and until() methods.

For MinutesInterval, the interval value must be a divisor of 60 as a numeric string (i.e. 1,2,3,4,5,6,10,12,15,20,30,60).

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

Code Style

Easily check the code style against PSR-12 Coding Standard by running:

And automatically fix them with this:

Contributing

Please see CONTRIBUTING for details.

Credits

License

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


All versions of crontab-schedule-generator with dependencies

PHP Build Version
Package Version
Requires php Version 7.3.* | 7.4.* | 8.0.* | 8.1.*
ext-intl Version *
beberlei/assert 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 garethellis/crontab-schedule-generator contains the following files

Loading the files please wait ....