Download the PHP package morningtrain/wp-queue without Composer

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

Morningtrain\WP\Queue

Queue system for WordPress.

Table of Contents

Introduction

This package is made to dispatch jobs to a queue system.

It is implementet with WP CLI so it can be runned from the command line.

Getting started

To get started install the package as described below in Installation.

To use the package have a look at Usage

Installation

Install with composer.

Usage

Register Worker

To get started with the module simply register a job queue \Morningtrain\WP\Queue\Queue::registerWorker().

You can change name of the job queue from default job_queue. You can change the version of the job queue database table from default 1.0.0.

Create a Job

Jobs can be created by extending Morningtrain\WP\Queue\Abstracts\AbstractJob and create a handle method.

You can define which job_queue the job should use by setting the $worker parameter to the job queue slug.

Now you can put a job in the queue by calling the static method dispatch on your Job class.

Alternatively Job Creation

Jobs can alternativley be created directly from the worker, by passing a callback to the createJob method.

Arguments

If you use arguments in your jobs, you have to be aware, that we are using call_user_func_array. So if you pass an array, you need to have same number of arguments in your method as you have in your array. And if keyed, the arguments in the method must be called the same as the keys.

If you do not know the number of arguments in your array or you just need to work on an data array, you can use ...$args in your method. Or you can wrap your array in an extra array containing only the one argument.

See more about call_user_func_arrey on the PHP documentation

Running the Queue Worker

Use WP CLI to run the job queue. See WP CLI documentation.

Start Worker

Start job queue with the wp queue start command and the worker slug.

Note

The worker will run until it is manually stopped or the terminal is closed. You should use a process monitor such as Supervisor to make sure the process does not stop unintended.

You can run multiple workers simultaneously.

Stop Worker

To stop a worker that you can not stop by closing you terminal, you can use the stop command with the worker slug.

To stop all workers use all instead of worker slug.

List available workers

To list available workers and their status, use the list command

Process a Specific Job

Call wp queue run with the worker slug and the job ID to process the specific job.

Note

You can use --untouched to not set run_date and result

You can use --force to force the job to run even though it has run before

Credits

License

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


All versions of wp-queue with dependencies

PHP Build Version
Package Version
Requires morningtrain/php-loader Version ^0.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 morningtrain/wp-queue contains the following files

Loading the files please wait ....