teknoo / reactphp-symfony
Bridge to use Symfony Framework with ReactPHP
Installs: 12 421
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 3
Forks: 3
Open Issues: 0
Requires
- php: >=7.0
- react/http: ^0.7.0
- riverline/multipart-parser: ~1.1
- symfony/console: ~3.0
- symfony/psr-http-message-bridge: ~1.0
- symfony/symfony: ~3.0
Requires (Dev)
- doctrine/doctrine-bundle: ^1.6.0
- pdepend/pdepend: ~2.5
- phploc/phploc: ~3.0
- phpmd/phpmd: ~2.6
- phpunit/phpunit: ~5.4
- sebastian/phpcpd: ~3.0
- squizlabs/php_codesniffer: ~2.8
This package is auto-updated.
Last update: 2020-10-09 05:12:14 UTC
README
Installation & Requirements
To install this library with composer, run this command :
composer require react/http:dev-master
composer require teknoo/reactphp-symfony
This library requires :
* PHP 7+
* Composer
* Symfony 3.2+
* ReactPHP 0.6+
Execution
Via the Symfony Console :
#Env prod
bin/console reactphp:run -i 0.0.0.0 -p 8080
#End dev
bin/console reactphp:run -i 0.0.0.0 -p 8080 -e dev
Via a PHP file :
#!/usr/bin/env php
<?php
use React\EventLoop\Factory as LoopFactory;
use React\Socket\Server as SocketServer;
use React\Http\Server as HttpServer;
use Teknoo\ReactPHPBundle\Bridge\RequestBridge;
use Teknoo\ReactPHPBundle\Bridge\RequestListener;
use Teknoo\ReactPHPBundle\Service\DatesService;
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
require __DIR__.'/../app/autoload.php';
if (\file_exists(__DIR__.'/../var/bootstrap.php.cache')) {
include_once __DIR__ . '/../var/bootstrap.php.cache';
}
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$requestBridge = new RequestBridge(
$kernel,
new DatesService(),
new HttpFoundationFactory(),
new DiactorosFactory()
);
$requestListener = new RequestListener($requestBridge);
//React Loop
$loop = LoopFactory::create();
//Create front socket server
$socket = new SocketServer(8080, $loop);
//Enable HTTP server
$server = new HttpServer($requestListener);
$server->listen($socket);
//Start loop and so the server
$loop->run();
Credits
Richard Déloge - richarddeloge@gmail.com - Lead developer. Teknoo Software - http://teknoo.software
About Teknoo Software
Teknoo Software is a PHP software editor, founded by Richard Déloge. Teknoo Software's DNA is simple : Provide to our partners and to the community a set of high quality services or software, sharing knowledge and skills.
License
ReactPHP Symfony Bridge is licensed under the MIT License - see the licenses folder for details
Contribute :)
You are welcome to contribute to this project. Fork it on Github