Download the PHP package raicem/laravel-defer-jobs without Composer

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

Laravel Defer Jobs

Defer your jobs to be executed after the response is sent*. Without a queue system.

*Only if you are using php-fpm. See requirements section for more info.

Why

Sometimes you don't want to setup a queue system just to do some light work outside of the request and response cycle. This package is created to show it is possible to extract some work out of the request and response cycle without using a queue system. Please note, this is more of a proof of concept and I believe there can be more robust implementations.

How

php-fpm exposes a function called fastcgi_finish_request which is used by Laravel to send the request to the webserver.

Laravel exposes a method called terminate in the middlewares that allows you to do some work after fastcgi_finish_request function is called. This package is basically just a service that collects jobs to be deferrered and runs them in the terminate function in a middleware.

Installation

Install package using composer

This package support auto discovery. So the service provider should be registered automatically.

You have to register the middleware manually. You can register it in the app/Http/Kernel.php file.

Then you are ready to go.

Usage

This package leverages Laravel's job implementation. Jobs are objects to be sent to the queue system.

First you can create a job.

In your job class implement the Deferrable trait.

Now you can call the job anywhere you want. For example in your controller.

Your job will be executed after the response is sent.

Please note this package does not have any relation with the queue system. You can still create a job and send it to the proper queue system.

Using job objects will allow you the switch implementations later down the line. If you no longer want to defer jobs and want to send them to the queue system, it very simple.

Use cases

Basically, some light work that would slow your response times.

Requirements

This package will only do its effect if you are using php-fpm to execute your code. If you don't use php-fpm and still try to use it, it will have no effect and it will run the jobs before the response is sent.

Warning

Please note that, if you want to do heavy work using this method, this package is not very suitable for you. php-fpm will keep the process open until your script ends. By doing so you may hit the maximum limit of the child processes of php-fpm. If you hit that limit, you may not receive any new requests.


All versions of laravel-defer-jobs with dependencies

PHP Build Version
Package Version
Requires php Version ^7.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 raicem/laravel-defer-jobs contains the following files

Loading the files please wait ....