cakedc / cakephp-roadrunner
Roadrunner bridge and worker for CakePHP
Installs: 212
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 6
Forks: 4
Open Issues: 0
Type:cakephp-plugin
Requires
- cakephp/cakephp: ^3.6
- relay/middleware: ^1.2
- spiral/roadrunner: ^1.3
Requires (Dev)
- phpunit/phpunit: ^5.7|^6.0
This package is auto-updated.
Last update: 2023-10-26 12:23:36 UTC
README
Requirements
- CakePHP 3.6.0+
- PHP 7.1+
Setup
composer require cakedc/cakephp-roadrunner
- Download roadrunner binary and place the file in your filesystem, for example under
/usr/local/bin/rr
- Create a RoadRunner worker file, or use the example worker provided
cp vendor/cakedc/cakephp-roadrunner/worker/cakephp-worker.php . cp vendor/cakedc/cakephp-roadrunner/worker/.rr.json .
Note the configuration is stored in .rr.json file, check all possible keys here https://github.com/spiral/roadrunner/wiki/Configuration
- Start the server, either using your own configuration or the sample configuration provided in the plugin
/usr/local/bin/rr serve
- If you need sessions
- Ensure you add the following to your session config in your CakePHP
config/app.php
- Ensure you add the following to your session config in your CakePHP
'Session' => [ 'defaults' => 'php', 'ini' => [ 'session.use_trans_sid' => false, 'session.use_cookies' => false, 'session.use_only_cookies' => true, 'session.cache_limiter' => '', 'session.save_handler' => 'user', ], ],
- Add the session middleware to your
src/Application.php
middleware queue
->add(new \Relay\Middleware\SessionHeadersHandler())
- Nginx proxy
You'll possibly need to configure a webserver to handle requests, serve static assets etc. Use this sample config virtualhost for nginx:
server {
listen 80;
server_name example.com;
root /var/virtual/example.com/webroot;
location / {
try_files $uri @backend8080;
}
location @backend8080 {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
Documentation
For documentation, as well as tutorials, see the Docs directory of this repository.
Support
For bugs and feature requests, please use the issues section of this repository.
Commercial support is also available, contact us for more information.
Contributing
This repository follows the CakeDC Plugin Standard. If you'd like to contribute new features, enhancements or bug fixes to the plugin, please read our Contribution Guidelines for detailed instructions.
License
Copyright 2019 Cake Development Corporation (CakeDC). All rights reserved.
Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.
Todo
- Existing issue setting cookies like $this->response = $this->response->withHeader('head', 'one'); conflicts with session cookie generation