|
| 1 | +<p align="center"> |
| 2 | + <img src="https://user-images.githubusercontent.com/796136/50286124-6f7f3780-046f-11e9-9f45-e8fedd4f786d.png" height="75px" alt="RoadRunner"> |
| 3 | +</p> |
| 4 | +<p align="center"> |
| 5 | + <a href="https://packagist.org/packages/spiral/roadrunner"><img src="https://poser.pugx.org/spiral/roadrunner/version"></a> |
| 6 | + <a href="https://pkg.go.dev/github.com/spiral/roadrunner?tab=doc"><img src="https://godoc.org/github.com/spiral/roadrunner?status.svg"></a> |
| 7 | + <a href="https://github.com/spiral/roadrunner/actions"><img src="https://github.com/spiral/roadrunner/workflows/CI/badge.svg" alt=""></a> |
| 8 | + <a href="https://goreportcard.com/report/github.com/spiral/roadrunner"><img src="https://goreportcard.com/badge/github.com/spiral/roadrunner"></a> |
| 9 | + <a href="https://scrutinizer-ci.com/g/spiral/roadrunner/?branch=master"><img src="https://scrutinizer-ci.com/g/spiral/roadrunner/badges/quality-score.png"></a> |
| 10 | + <a href="https://codecov.io/gh/spiral/roadrunner/"><img src="https://codecov.io/gh/spiral/roadrunner/branch/master/graph/badge.svg"></a> |
| 11 | + <a href="https://lgtm.com/projects/g/spiral/roadrunner/alerts/"><img alt="Total alerts" src="https://img.shields.io/lgtm/alerts/g/spiral/roadrunner.svg?logo=lgtm&logoWidth=18"/></a> |
| 12 | + <a href="https://discord.gg/TFeEmCs"><img src="https://img.shields.io/badge/discord-chat-magenta.svg"></a> |
| 13 | + <a href="https://packagist.org/packages/spiral/roadrunner"><img src="https://img.shields.io/packagist/dd/spiral/roadrunner?style=flat-square"></a> |
| 14 | +</p> |
| 15 | + |
| 16 | +RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. |
| 17 | +It supports running as a service with the ability to extend its functionality on a per-project basis. |
| 18 | + |
| 19 | +RoadRunner includes PSR-7/PSR-17 compatible HTTP and HTTP/2 server and can be used to replace classic Nginx+FPM setup |
| 20 | +with much greater performance and flexibility. |
| 21 | + |
| 22 | +<p align="center"> |
| 23 | + <a href="https://roadrunner.dev/"><b>Official Website</b></a> | |
| 24 | + <a href="https://roadrunner.dev/docs"><b>Documentation</b></a> |
| 25 | +</p> |
| 26 | + |
| 27 | +Repository: |
| 28 | +-------- |
| 29 | +This repository contains the codebase PSR-7 PHP workers. |
| 30 | +Check [spiral/roadrunner](https://github.com/spiral/roadrunner) to get application server. |
| 31 | + |
| 32 | +Installation: |
| 33 | +-------- |
| 34 | +To install application server and HTTP codebase: |
| 35 | + |
| 36 | +```bash |
| 37 | +$ composer require spiral/roadrunner-http nyholm/psr7 |
| 38 | +$ vendor/bin/rr get-binary |
| 39 | +``` |
| 40 | + |
| 41 | +> You can use any PSR-15 compatible implementation. |
| 42 | +
|
| 43 | +Example: |
| 44 | +------- |
| 45 | +To init abstract RoadRunner worker: |
| 46 | + |
| 47 | +```php |
| 48 | +<?php |
| 49 | + |
| 50 | +use Spiral\RoadRunner; |
| 51 | +use Nyholm\Psr7\Factory; |
| 52 | + |
| 53 | +ini_set('display_errors', 'stderr'); |
| 54 | +include "vendor/autoload.php"; |
| 55 | + |
| 56 | +$worker = new RoadRunner\Http\PSR7Worker( |
| 57 | + RoadRunner\Worker::create(), |
| 58 | + new Factory\Psr17Factory(), |
| 59 | + new Factory\Psr17Factory(), |
| 60 | + new Factory\Psr17Factory() |
| 61 | +); |
| 62 | + |
| 63 | +while ($req = $worker->waitRequest()) { |
| 64 | + try { |
| 65 | + $rsp = new \Nyholm\Psr7\Response(); |
| 66 | + $rsp->getBody()->write("hello world"); |
| 67 | + |
| 68 | + $worker->respond($rsp); |
| 69 | + } catch (\Throwable $e) { |
| 70 | + $worker->getWorker()->error((string)$e); |
| 71 | + } |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +Testing: |
| 76 | +-------- |
| 77 | +This codebase is automatically tested via host repository - [spiral/roadrunner](https://github.com/spiral/roadrunner). |
| 78 | + |
| 79 | +License: |
| 80 | +-------- |
| 81 | +The MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained |
| 82 | +by [Spiral Scout](https://spiralscout.com). |
0 commit comments