Download the PHP package tekod/wp-queue without Composer

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

License: MIT Issues

WpQueue

By using queue developer can defer the processing of a time-consuming task for later time, and thus drastically speeding up the web requests of your application.

This library is WordPress implementation of AccentPHP's Queue library.

Usage

For beginning, you must initialize and configure your first queue manager. In this example we will create queue that will dispatch emails. We can give arbitrary name to our queues, let we use "mailer" for this one. Global function "WpQueue" will return instance of queue by its name and create is if it does not exist.
After that we should call "init" method to configure our queue. In this example we will store queued jobs in database using WordPress "wpdb" connection, in table "wp_wpqueue_mailer_jobs". There are many other configuration options, but you can explore them later.

Now we can add new job into queue, you have to pass name of job and job data. In this example we want to send an email:

To register job handler you have to connect job name with callback (callable), just like WordPress hooks. In this example we will register static method for "SendEmail" job:

Job handler method will receive job-object as parameter. You must execute Job->setHandled() at the end of your handler to mark job as handled or Job->setReleased() to mark it as failed. Handled jobs will be removed from queue while failed jobs will be postponed. Example of job handler:

To run your queue you should execute WpQueue::run() and specify what jobs you want to execute and few config options. If you specify parameter only jobs of that name will be executed, otherwise queue will execute all type of jobs.

Queue will execute all currently available jobs in loop, but each job can push more jobs into queue, with high or low priority, so execution can be very dynamic.

Note that multiple handlers can be registered on single job name, queue manager will pass job to first handler and if it does not mark it as handled job will be offered to next registered handler. Using this feature you can intercept and take over normal job execution in certain cases, or just monitor and log jobs if you omit to set handled status.

If a job remains unhandled queue will dispatch "orphaned job" wp-action and offer hook listeners to handle it in "catch-all" manner.

If a job remains unhandled after that queue will dispatch "unhandled job" action and delete job if nobody respond.



Security issues

If you have found a security issue, please contact the author directly at [email protected].


All versions of wp-queue with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.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 tekod/wp-queue contains the following files

Loading the files please wait ....