PHPackages                             avto-dev/roadrunner-laravel - 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. avto-dev/roadrunner-laravel

Abandoned → [spiral/roadrunner-laravel](/?search=spiral%2Froadrunner-laravel)ArchivedLibrary

avto-dev/roadrunner-laravel
===========================

RoadRunner bridge for Laravel applications

v3.3.0(5y ago)11928.7k↓100%15[1 issues](https://github.com/avto-dev/roadrunner-laravel/issues)MITPHPPHP ^7.1.3

Since Feb 4Pushed 5y ago7 watchersCompare

[ Source](https://github.com/avto-dev/roadrunner-laravel)[ Packagist](https://packagist.org/packages/avto-dev/roadrunner-laravel)[ RSS](/packages/avto-dev-roadrunner-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (26)Used By (0)

 [![](https://camo.githubusercontent.com/a343790ed0b233ece692be18fa2e784a7c7626bb04dc7e2e59a5e1af697ce723/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323661302e706e67)](https://camo.githubusercontent.com/a343790ed0b233ece692be18fa2e784a7c7626bb04dc7e2e59a5e1af697ce723/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323661302e706e67) **This package is abandoned and no longer maintained** [![](https://camo.githubusercontent.com/a343790ed0b233ece692be18fa2e784a7c7626bb04dc7e2e59a5e1af697ce723/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323661302e706e67)](https://camo.githubusercontent.com/a343790ed0b233ece692be18fa2e784a7c7626bb04dc7e2e59a5e1af697ce723/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323661302e706e67)
 We suggests using the [spiral/roadrunner-laravel](https://github.com/spiral/roadrunner-laravel) package instead

[RoadRunner](https://github.com/spiral/roadrunner) ⇆ Laravel bridge
===================================================================

[](#roadrunner--laravel-bridge)

[![Version](https://camo.githubusercontent.com/bf300219d95974c10799626bd00deed035baedb712b900e167a18f0531a6e9c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6176746f2d6465762f726f616472756e6e65722d6c61726176656c2e7376673f6d61784167653d313830)](https://packagist.org/packages/avto-dev/roadrunner-laravel)[![Version](https://camo.githubusercontent.com/528321560a136b80681b1c5404d8d153410c869b2527159ab3edc34f17350a6f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6176746f2d6465762f726f616472756e6e65722d6c61726176656c2e7376673f6c6f6e6743616368653d74727565)](https://packagist.org/packages/avto-dev/roadrunner-laravel)[![Build Status](https://camo.githubusercontent.com/10465461252e9353bbd43dd702927640111df748294b3d3e6ea4dd8e0d1d58d7/68747470733a2f2f7472617669732d63692e6f72672f6176746f2d6465762f726f616472756e6e65722d6c61726176656c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/avto-dev/roadrunner-laravel)[![Coverage](https://camo.githubusercontent.com/a2b6ec670f5c2fd14e2c5030b75ddfda08acdc80e3bb31d343c98faf0254e51b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6176746f2d6465762f726f616472756e6e65722d6c61726176656c2f6d61737465722e7376673f6d61784167653d3630)](https://codecov.io/gh/avto-dev/roadrunner-laravel/)[![Downloads count](https://camo.githubusercontent.com/bc4d94bac05beabce464749547b4abe0b12e178e213e6b8335a5feb791b8298f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6176746f2d6465762f726f616472756e6e65722d6c61726176656c2e7376673f6d61784167653d313830)](https://packagist.org/packages/avto-dev/roadrunner-laravel)[![License](https://camo.githubusercontent.com/e46e4502edc7557a859d5ec3dbd603fa412a4fe41301ba006444ba2748ab6d9b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6176746f2d6465762f726f616472756e6e65722d6c61726176656c2e7376673f6c6f6e6743616368653d74727565)](https://github.com/avto-dev/roadrunner-laravel/blob/master/LICENSE)

Easy way for connecting [RoadRunner](https://github.com/spiral/roadrunner) and [Laravel](https://laravel.com) applications.

Installation
------------

[](#installation)

Require this package with composer using next command:

```
$ composer require avto-dev/roadrunner-laravel "^3.3"
```

> Installed `composer` is required ([how to install composer](https://getcomposer.org/download/)).

> You need to fix the major version of package.

> Previous major versions still available, but it's development is abandoned. Use only latest major version!

After that you can "publish" package configuration file (`./config/roadrunner.php`) using next command:

```
$ php ./artisan vendor:publish --provider='AvtoDev\RoadRunnerLaravel\ServiceProvider' --tag=config
```

And basic RoadRunner configuration file (`./.rr.yaml.dist`):

```
$ php ./artisan vendor:publish --provider='AvtoDev\RoadRunnerLaravel\ServiceProvider' --tag=rr-config
```

After that you can modify configuration files as you wish.

**Important**: despite the fact that worker allows you to refresh application instance on each HTTP request *(if environment variable `APP_REFRESH` set to `true`)*, we strongly recommend to avoid this for performance reasons. Large applications can be hard to integrate with RoadRunner *(you must decide which of service providers must be reloaded on each request, avoid "static optimization" in some cases)*, but it's worth it.

Usage
-----

[](#usage)

After package installation you can use provided "binary" file as RoadRunner worker: `./vendor/bin/rr-worker`. This worker allows you to interact with incoming requests and outcoming responses using [laravel events system](https://laravel.com/docs/events). Also events contains:

Event classnameApplication objectHTTP server requestHTTP requestHTTP responseException`BeforeLoopStartedEvent`✔`BeforeLoopIterationEvent`✔✔`BeforeRequestHandlingEvent`✔✔`AfterRequestHandlingEvent`✔✔✔`AfterLoopIterationEvent`✔✔✔`AfterLoopStoppedEvent`✔`LoopErrorOccurredEvent`✔✔✔Simple `.rr.yaml` config example:

```
env:
  #APP_REFRESH: true

http:
  address: 0.0.0.0:8080
  workers:
    command: 'php ./vendor/bin/rr-worker'

static:
  dir: 'public'
```

Roadrunner server starting:

```
$ rr -c ./.rr.yaml serve -d
```

### Listeners

[](#listeners)

This package provides event listeners for resetings application state without full application reload *(like cookies, HTTP request, application instance, service-providers and other)*. Some of them already declared in configuration file, but you can declare own without any limitations.

### Environment variables

[](#environment-variables)

You can use the following environment variables:

Variable nameDescription`APP_FORCE_HTTPS`*(declared in configuration file)* Forces application HTTPS schema usage`APP_REFRESH`Refresh application instance on every request### Known issues

[](#known-issues)

#### Controller constructors

[](#controller-constructors)

You should avoid to use HTTP controller constructors *(created or resolved instances in constructor can be shared between different requests)*. Use dependencies resolving in controller **methods** instead.

Bad:

```
