Download the PHP package sebkay/wp-queued-jobs without Composer

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

WP Queued Jobs

Validate PHP

A Laravel-like queue system for WordPress.

Easily create background jobs for things like sending emails or importing large amounts of data. All with a fluent API.

I highly recommend using a plugin like WP Crontrol so you can easily see, and manually run, cron jobs from the WordPress dashboard.

Requires PHP 7.4+


Install

The recommended way to install this package is via Composer.

Usage

1. Create job

To create a job, you need to extend the WpQueuedJobs\Jobs\Job class:

2. Add job to queue and dispatch

Anything passed as the second parameter to addJob() will be available in the handle() method of the job (and the rest of the class) as $this->data.

The data can be anything you want. A string, array, integer, class etc...

The "queue worker" will look for new jobs every 1 minute and run them (if there are any).

The system runs on a "first-in first-out" basis. So whatever gets dispatched first will be run first.

Important

As the lowest cron time in WordPress defaults to 1 minute, jobs scheduled to run at 6am might not actually run until 6:01am. This isn't an issue in the majority of cases, but it's worth knowing.

The point of background jobs is that they run in the background, not immediately, so they should never be used for time-sensitive tasks.

Example #1 (Send Email)

  1. Load the "successful registration" page template.
  2. Add the "send welcome email" job and dispatch it to the queue.

Example #2 (Import Posts from API)

  1. Create a custom cron event.
  2. Add two jobs and dispatch them to the queue.
  3. Each job is given an offset and a max so the same posts aren't imported twice.
  4. Schedule the cron even to run once per day at 6am, starting tomorrow.

Why

Unfortunatetly there's no concept of a "queue worker" in WordPress. At it's core WordPress is just a bunch of PHP files. There's no command line runner, such as Artisan in Laravel.

Although the WordPress CLI exists, a lot of people host their sites on shared hosting, so that isn't an option.

This package tries to circumvent that by utilising the WordPress Cron system. It runs a WP Cron task every minute to see if there are new jobs to run. If there are then it locks the connection to the database, runs the jobs, then unlocks the connection.

It's important to lock the queue to prevent the same jobs from running multiple times. The "queue worker" checks if there are new jobs every minute, so if any queue takes longer than a minute to finish jobs won't overlap.


All versions of wp-queued-jobs with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4|>=8.0
monolog/monolog Version <=2.3.5
ramsey/uuid Version <=4.2.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 sebkay/wp-queued-jobs contains the following files

Loading the files please wait ....