PHPackages                             crowdstar/background-processing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. crowdstar/background-processing

ActiveLibrary

crowdstar/background-processing
===============================

To continue processing PHP after having HTTP response sent back to the client under PHP-FPM.

1.0.2(2y ago)2357.7k↓19.1%3Apache-2.0PHPPHP &gt;=7.0CI passing

Since May 31Pushed 2mo ago6 watchersCompare

[ Source](https://github.com/Crowdstar/background-processing)[ Packagist](https://packagist.org/packages/crowdstar/background-processing)[ Docs](https://www.glu.com)[ RSS](/packages/crowdstar-background-processing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

[![Library Status](https://github.com/Crowdstar/background-processing/workflows/Tests/badge.svg)](https://github.com/Crowdstar/background-processing/actions)[![Latest Stable Version](https://camo.githubusercontent.com/b52ffbb53416cbd3e676f23bfba05163ca55f200ab57586726a6bed968ceb7e1/68747470733a2f2f706f7365722e707567782e6f72672f43726f7764737461722f6261636b67726f756e642d70726f63657373696e672f762f737461626c652e737667)](https://packagist.org/packages/crowdstar/background-processing)[![Latest Unstable Version](https://camo.githubusercontent.com/6bd7f321f03e6e987024d210dfb7914be570e4b5bd6a4511fbce3cc5340dbdb1/68747470733a2f2f706f7365722e707567782e6f72672f43726f7764737461722f6261636b67726f756e642d70726f63657373696e672f762f756e737461626c652e737667)](https://packagist.org/packages/crowdstar/background-processing)[![License](https://camo.githubusercontent.com/06de6c8e021ff928c2d38792e8fc3277c0a80c16fe8ed320dbe974eaabc092f8/68747470733a2f2f706f7365722e707567782e6f72672f43726f7764737461722f6261636b67726f756e642d70726f63657373696e672f6c6963656e73652e737667)](https://packagist.org/packages/crowdstar/background-processing)

This package allows continuing processing PHP after having HTTP response sent back to the client under PHP-FPM.

PHP functions added by this package are executed after HTTP response sent back to the client but before PHP shutdown ( before any registered shutdown function is called). For detailed discussions on PHP shutdown sequence, function *fastcgi\_finish\_request()* and related topics, please check the post "[Background Processing in PHP](https://github.com/deminy/background-processing-in-php)".

Limitations and Side Effects
============================

[](#limitations-and-side-effects)

This package is for PHP-FPM only. Don't try to run it under CLI, PHP built-in web server, mod\_php or FastCGI since it won't work.

After sending HTTP response back to client side, background functions added continue to run and the PHP-FPM process is still running. To avoid side effects on your web server, please use this package accordingly. You may consider using some worker instances or queue servers instead. When using this package, you may consider following suggestions to minimize side effects:

- increase number of child processes in PHP-FPM.
- increase maximum execution time for PHP-FPM.

When using locks, please note that subsequent requests might block even client side has received a response from a previous request, since a lock may still be active while running background tasks in the previous request.

Installation
============

[](#installation)

```
composer require crowdstar/background-processing:~1.0.0
```

Sample Usage
============

[](#sample-usage)

```
