Download the PHP package yii2tech/crontab without Composer

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

Crontab Extension for Yii 2


This extension adds Crontab setup support.

For license information check the LICENSE-file.

Latest Stable Version Total Downloads Build Status

Requirements

This extension requires Linux OS. 'crontab' should be installed and cron daemon should be running.

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json.

Usage

You can setup cron tab using [[yii2tech\crontab\CronTab]], for example:

You may specify particular cron job using [[yii2tech\crontab\CronJob]] instance, for example:

Tip: [[yii2tech\crontab\CronJob]] is a descendant of [[yii\base\Model]] and have built in validation rules for each parameter, thus it can be used in the web forms to create a cron setup interface.

Parsing cron jobs

[[yii2tech\crontab\CronJob]] composes a cron job line, like:

However it can also parse such lines filling up own internal attributes. For example:

Merging cron jobs

Method [[yii2tech\crontab\CronTab::apply()]] adds all specified cron jobs to crontab, keeping already exiting cron jobs intact. For example, if current crontab is following:

running following code:

will produce following crontab:

While merging crontab lines [[yii2tech\crontab\CronTab::apply()]] avoids duplication, so same cron job will never be added twice. However while doing this, lines are compared by exact match, inlcuding command and time pattern. If same command added twice with different time pattern - 2 crontab records will be present. For example, if current crontab is following:

running following code:

will produce following crontab:

You may interfere in merging process using [[yii2tech\crontab\CronTab::$mergeFilter]], which allows indicating those existing cron jobs, which should be removed while merging. Its value could be a plain string - in this case all lines, which contains this string as a substring will be removed, or a PHP callable of the following signature: bool function (string $line) - if function returns true the line should be removed. For example, if current crontab is following:

running following code:

will produce following crontab:

Extra lines setup

Crontab file may content additional lines beside jobs specifications. It may contain comments or extra shell configuration. For example:

You may append such extra lines into the crontab using [[yii2tech\crontab\CronTab::$headLines]]. For example:

Note: usage of the headLines may produce unexpected results, while merging crontab with existing one.

User setup

Each Linux system user has his own crontab. Ownership of crontab affected by this extension is determined by the user running the PHP script. For the web application it is usually 'apache', for the console application - current local user or root. Thus crontab application from web application and from console application will produce 2 separated cron jobs list for 2 different system users.

You may explicitly setup name of the user whose crontab is to be affected via [[yii2tech\crontab\CronTab::$username]]. For example:

However, this will work only in case PHP script is running from privileged user (e.g. 'root').


All versions of crontab with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version ~2.0.14
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 yii2tech/crontab contains the following files

Loading the files please wait ....