{"id":13686132,"url":"https://github.com/antidot-framework/reactive-antidot-starter","last_synced_at":"2025-04-22T21:30:30.876Z","repository":{"id":36347499,"uuid":"223640521","full_name":"antidot-framework/reactive-antidot-starter","owner":"antidot-framework","description":"Reactive Antidot Framework Apllication Starter","archived":false,"fork":false,"pushed_at":"2022-11-07T23:09:21.000Z","size":69,"stargazers_count":14,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"2.x.x","last_synced_at":"2025-04-02T04:03:56.185Z","etag":null,"topics":["composer","psr-11","psr-15","psr-7","react-php","reactive-antidot-framework"],"latest_commit_sha":null,"homepage":"https://antidotfw.io","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antidot-framework.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"kpicaza"}},"created_at":"2019-11-23T19:16:27.000Z","updated_at":"2023-02-15T10:46:20.000Z","dependencies_parsed_at":"2023-01-17T01:01:11.446Z","dependency_job_id":null,"html_url":"https://github.com/antidot-framework/reactive-antidot-starter","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antidot-framework%2Freactive-antidot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antidot-framework%2Freactive-antidot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antidot-framework%2Freactive-antidot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antidot-framework%2Freactive-antidot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antidot-framework","download_url":"https://codeload.github.com/antidot-framework/reactive-antidot-starter/tar.gz/refs/heads/2.x.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250328088,"owners_count":21412555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","psr-11","psr-15","psr-7","react-php","reactive-antidot-framework"],"created_at":"2024-08-02T15:00:20.351Z","updated_at":"2025-04-22T21:30:30.604Z","avatar_url":"https://github.com/antidot-framework.png","language":"PHP","funding_links":["https://github.com/sponsors/kpicaza"],"categories":["Frameworks"],"sub_categories":[],"readme":"Reactive Antidot Framework\n=================\n\n[![link-packagist](https://img.shields.io/packagist/v/antidot-fw/reactive-starter.svg?style=flat-square)](https://packagist.org/packages/antidot-fw/reactive-starter)\n\nThis framework is based on concepts and components of other open source software, especially \n[Zend Expressive](https://docs.zendframework.com/zend-expressive/), \n[Zend Stratigillity](https://docs.zendframework.com/zend-stratigility/), \n[Recoil](https://github.com/recoilphp/recoil) and [React PHP](https://reactphp.org/).\n\n## Installation\n\nInstall a project using [composer](https://getcomposer.org/download/) package manager:\n\n````bash\ncomposer create-project antidot-fw/reactive-starter dev\nmv dev/.* dev/* ./ \u0026\u0026 rmdir dev\nbin/console server:run\n````\n\nOpen your browser localhost on port `5555` and you will see the [DriftPHP Server](https://github.com/driftphp/server) up and running.\n\n## Config\n\n### Server Config\n\nDefault config\n\n```yaml\nparameters:\n    server:\n      host: '0.0.0.0'\n      port: '5555'\n      max_concurrency: 100\n      buffer_size: 4096\n      workers: 4\n\n```\n\n### Development Mode\n\nTo run it in dev mode you can run `config:development-mode` command\n\n````bash\nbin/console config:development-mode\n````\n\nOr you can do it by hand renaming from `config/services/dependencies.dev.yaml.dist` to `config/services/dependencies.dev.yaml`\n\n````bash\nmv config/services/dependencies.dev.yaml.dist config/services/dependencies.dev.yaml\n````\n\n### Hot Code Reloading\n\n```bash\ncomposer require seregazhuk/php-watcher --dev\n```\n\nYou can use [Php whatcher](https://github.com/seregazhuk/php-watcher) with composer for more friendly development.\n\n````bash\nbin/console server:watch\n````\n\n![Default homepage](https://getting-started.antidotfw.io/images/default-homepage.jpg)\n\nOpen another console and check the built-in Cli tool\n\n````bash\nbin/console\n````\n\n![Default console tool](https://getting-started.antidotfw.io/images/default-console.jpg)\n\n## Async Usage\n\nIt allows executing promises inside PSR-15 and PSR-7 Middlewares and request handlers\n\n### PSR-15 Middleware\n\n```php\n\u003c?php\ndeclare(strict_types = 1);\n\nnamespace App;\n\nuse Antidot\\React\\PromiseResponse;\nuse Psr\\Http\\Message\\ResponseInterface;\nuse Psr\\Http\\Message\\ServerRequestInterface;\nuse Psr\\Http\\Server\\MiddlewareInterface;\nuse Psr\\Http\\Server\\RequestHandlerInterface;\n\nclass SomeMiddleware implements MiddlewareInterface\n{\n    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface\n    {\n        return new PromiseResponse(\n            resolve($request)-\u003ethen(static fn(ServerrequestInsterface $request) =\u003e $handler-\u003ehandle($request))\n        );\n    }\n}\n```\n\n### PSR-7 Request Handler\n\n```php\n\u003c?php\ndeclare(strict_types = 1);\n\nnamespace App;\n\nuse Antidot\\React\\PromiseResponse;\nuse Psr\\Http\\Message\\ResponseInterface;\nuse Psr\\Http\\Message\\ServerRequestInterface;\nuse Psr\\Http\\Server\\RequestHandlerInterface;\n\nclass SomeMiddleware implements RequestHandlerInterface\n{\n    public function process(ServerRequestInterface $request): ResponseInterface\n    {\n        return resolve($request)-\u003ethen(\n            function(ServerrequestInterface $request): ResponseInterface {\n                return new Response('Hello World!!!');\n            }\n        );;\n    }\n}\n```\n\n## Classic Usage\n\nIt allows executing classic PSR-15 middleware and request handler:\n\n### PSR-15 Middleware\n\n```php\n\u003c?php\ndeclare(strict_types = 1);\n\nnamespace App;\n\nuse Psr\\Http\\Message\\ResponseInterface;\nuse Psr\\Http\\Message\\ServerRequestInterface;\nuse Psr\\Http\\Server\\MiddlewareInterface;\nuse Psr\\Http\\Server\\RequestHandlerInterface;\n\nclass SomeMiddleware implements MiddlewareInterface\n{\n    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface\n    {\n        return $handler-\u003ehandle($request);\n    }\n}\n```\n\n### PSR-7 Request Handler\n\n```php\n\u003c?php\ndeclare(strict_types = 1);\n\nnamespace App;\n\nuse Psr\\Http\\Message\\ResponseInterface;\nuse Psr\\Http\\Message\\ServerRequestInterface;\nuse Psr\\Http\\Server\\RequestHandlerInterface;\n\nclass SomeMiddleware implements RequestHandlerInterface\n{\n    public function process(ServerRequestInterface $request): ResponseInterface\n    {\n        return new Response('Hello World!!!');\n    }\n}\n```\n\n## Benchmark\n\nUsing apache ab with single thread:\n\n```bash\n\u003e ab -n 40000 -c 64 http://127.0.0.1:8080/ \nThis is ApacheBench, Version 2.3 \u003c$Revision: 1843412 $\u003e\nCopyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\nLicensed to The Apache Software Foundation, http://www.apache.org/\n\nBenchmarking 127.0.0.1 (be patient)\n\nServer Software:        ReactPHP/1\nServer Hostname:        127.0.0.1\nServer Port:            8080\n\nDocument Path:          /\nDocument Length:        96 bytes\n\nConcurrency Level:      64\nTime taken for tests:   16.201 seconds\nComplete requests:      40000\nFailed requests:        0\nTotal transferred:      8960000 bytes\nHTML transferred:       3840000 bytes\nRequests per second:    2468.93 [#/sec] (mean)\nTime per request:       25.922 [ms] (mean)\nTime per request:       0.405 [ms] (mean, across all concurrent requests)\nTransfer rate:          540.08 [Kbytes/sec] received\n\nConnection Times (ms)\n              min  mean[+/-sd] median   max\nConnect:        0    0   0.0      0       1\nProcessing:    15   26   1.4     25      33\nWaiting:       15   26   1.4     25      33\nTotal:         16   26   1.4     25      33\n\nPercentage of the requests served within a certain time (ms)\n  50%     25\n  66%     25\n  75%     26\n  80%     26\n  90%     27\n  95%     29\n  98%     31\n  99%     32\n 100%     33 (longest request)\n\n```\n\nusing wrk:\n\n```bash\n\u003e wrk -t8 -c64 -d15s http://127.0.0.1:8080/                                                                                                                                                                                                         [95ba8e6]\nRunning 15s test @ http://127.0.0.1:8080/\n  8 threads and 64 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency    26.14ms    1.44ms  34.63ms   92.76%\n    Req/Sec   306.84     24.52   373.00     81.17%\n  36670 requests in 15.04s, 8.50MB read\nRequests/sec:   2437.45\nTransfer/sec:    578.42KB\n```\n\nSee ranking in [The Benchmarker - Web Framework](https://github.com/the-benchmarker/web-frameworks) project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantidot-framework%2Freactive-antidot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantidot-framework%2Freactive-antidot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantidot-framework%2Freactive-antidot-starter/lists"}