Download the PHP package oliverlundquist/laravel-http-background without Composer

On this page you can find all versions of the php package oliverlundquist/laravel-http-background. 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-http-background

Laravel HTTP Background

PHPUnit Coverage PHPStan PHP-CS-Fixer

Moves HTTP Requests out from PHP to a forked process on the server executing the request through cURL and then piping the results back into a Laravel Artisan command that fires events about the status of the response of the request. This enables PHP to execute without having to wait for responses from its HTTP requests, enabling one server instance to handle lots of outgoing HTTP requests without using many resources or blocking the execution of PHP. In my tests, 10 concurrent requests had a peak memory usage of only 40mb.

I wrote a blog about this package where I go into more detail about the motivation behind it and alternative methods that I tried before going down the route of forking HTTP requests into separate processes. It's available [here].

Installation

Usage

Options

->connectionTimeout()

Timeout to establish a connection (in seconds).

->timeout()

Maximum time allowed for the whole request (in seconds).

->retry()

Max attempts that this request can be retried, see the implementation example below.

->setRequestTag()

Arbitrary data used to identify the request.

->contentType()

Set the Content-Type header.

->accept()

Set the Accept header.

->withBody()

Set the body of the request, this can also be set implicitly by calling any of the HTTP verb short-hand methods ->post(), ->patch(), ->put(), ->delete(). The withBody() method can also set the Content-Type and Accept headers by providing values for the second and third arguments.

->queue()

Push the request to the Laravel Queue and fork a process on your queue worker server instance instead of your main PHP application server. This is useful if you don't want forked processes on your application server but rather have them processed on your server instance running the queue worker.

->processIsRunning()

Check whether the background process (pid) is still running.

Events

Events are fired to track the progress and result of the request.

Implementation Example

This is an example of a basic implementation that handles request retries and sends notifications of failed and timed-out requests by mail.

Windows Users

PowerShell is currently not supported. However, adding support shouldn't be too difficult, since the cURL arguments are mostly the same - just replace -o /dev/null with -o NUL.

I'm not a PowerShell expert, but I believe something like (Start-Job { & command }).Id could be used to retrieve the job ID. You could then check the job status later using Get-Job -Id $id.

If you're interested in contributing PowerShell support, feel free to open a pull request!


All versions of laravel-http-background with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
lib-curl Version *
illuminate/console Version ^11.0|^12.0
illuminate/contracts Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
illuminate/broadcasting Version ^11.0|^12.0
illuminate/queue Version ^11.0|^12.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 oliverlundquist/laravel-http-background contains the following files

Loading the files please wait ...