Download the PHP package token27/cakephp-scheduled-plugin without Composer

On this page you can find all versions of the php package token27/cakephp-scheduled-plugin. 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 cakephp-scheduled-plugin

Cake Scheduled

Cron Scheduled Plugin for CakePHP 4.x

Table of Contents

Introduction

Scheduled allows you to write cron jobs right from PHP files. It works for CakePHP shell as well as any other valid PHP code. Basically it is a replacement of the conventional crontab file.

Why Use It

The conventional way of writing a cron job is to place an entry in the crontab file each time you need to schedule a job. The problem with this approach is that you have to login(SSH) to the server each time.

By using Scheduled, we are able to place the cron jobs in the source control system and deploy them to production just like any other PHP code.

Installation

Starting The Scheduled

We only need to install one ordinary cron job which runs every minute. This cron job will enable Scheduled to schedule all the subsequent jobs:

Defining Schedules

A schedule is basically a PHP file prefix with Scheduled and ending with Task.php, it must return the Scheduled object. All schedules should be place inside a folder called ScheduledTasks. This folder must reside at the root directory where composer.json file is located.

For example:

Scheduling CakePHP Shell

To schedule a CakePHP shell, call Scheduled::shell:

Scheduling Any Other Commands

To schedule any other commands, call Scheduled::run:

Frequency Options

There is plenty of ways to define the frequency of the execution:

Method Description
->cron() the classic way of defining a schedule
->hourly() beginning of each hour
->daily() daily at midnight
->weekly sunday of each week
->monthly() first day of each month
->quarterly() first day of each quarter
->yearly() first day of each year
->everyFiveMinutes() every five minutes
->everyMinute() every minute
->everyTwelveHours() every twelve hours
->everyMonth() every month
->everySixMonths() every six months
->everyFifteenDays() every fifteen days
->on('13:30 2016-03-01') at a specific date and time
->at('13:30') at a specific time

Under the hood, Scheduled is using the great lavary/crunz library. It has a large number of options for us to configure the frequency of the execution. Check out its official documentation if you are looking for more available frequency.

Before A Job Runs

To do something before a job is executed, we can use the before() hook:

For example:

After A Job Is Finished

To do something after a job is executed, we can use the after() hook:

For example:


All versions of cakephp-scheduled-plugin with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
cakephp/cakephp Version ~4.2.0
lavary/crunz Version ~2.2
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 token27/cakephp-scheduled-plugin contains the following files

Loading the files please wait ....