Download the PHP package chriskonnertz/jobs without Composer

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

Jobs

Minimalistic Cron job manager. Register jobs and the job manager will execute them automatically depending on their interval.

NOTE: This is not a queue manager and therefore this has nothing to do with Laravel's queue component. Also note that Laravel 5 has an integrated task scheduler that works similar to this library.

Installation

This library requires PHP >= 7.0

Add chriskonnertz/jobs to composer.json:

"chriskonnertz/jobs": "3.*"

Or via a console:

In the future run composer update to update to the latest version of this library.

Framework support

This library supports Laravel >=5.5 with a service provider. Add the service provider to the config file config/app.php:

To create an alias for the facade, add this new entry in this file:

Introduction

Create a concrete job class:

Instantiate the job manager:

If you use Laravel with the service provider you do not have to worry about this. The service provider will inject the cache dependency. In any other case the cache class has to implement the cache interface (CacheInterface). Take a look at the LaravelCache class (that is meant for Laravel integration) for an example implementation.

Register the job:

Execute the registered jobs:

Automatically execute jobs

If your application is built on top of Laravel, you will have access to an Artisan command: php artisan jobs This command will call Jobs::run() to execute the jobs. Therefore you can add a Cron job to the crontab to start the command, for example 1 * * * * php /var/www/laravel/artisan jobs. This will execute the Artisan command every minute. We recommend to run the Cron job every minute.

Methods of the jobs manager

Note: Some of these methods may throw a JobException.

Determine if a job exists in the pool

Add a job to the pool (without lazy loading)

Add a job to the pool (with lazy loading)

We recommend using addLazy() over add().

Remove a job from the pool

Remove all jobs from the pool

Count the jobs

Get the remaining cool down

Get the timestamp of the last iteration

Set the minimum cool down time for all jobs

The minimum value and the initial value is one minute. Most likely there is no reason to change this value ever.

Set the cache key namespace

The job class

A job class implements the job interface. Therefore it has to implement these methods:

The AbstractJob class actually implements these methods so we recommend to let your concrete job classes inherit from this class. The abstract class provides the attributes name, active and interval that inheriting classes may overwrite.

The interval

Per default (as long as the inheriting job class does not overwrite it) the getInterval() is a simple getter for the interval attribute. The interval attribute defines the duration of the job's cool down in minutes. For example if it is 60 minutes (= 1 hour) the job is executed once per hour (max).

Status

Status of this repository: Deprecated. Issues will be fixed but no new feature implemented.


All versions of jobs with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
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 chriskonnertz/jobs contains the following files

Loading the files please wait ....