|
1 | 1 | <div align="center"> |
2 | 2 |
|
3 | | -# The PHP HTTP GALAXY |
| 3 | +# The Poakium Http Galaxy |
4 | 4 |
|
5 | | -[](http://php.net) |
6 | | -[](https://packagist.org/packages/biurad/php-http-galaxy) |
7 | | -[](https://github.com/biurad/php-http-galaxy/actions?query=workflow%3Abuild) |
8 | | -[](https://codeclimate.com/github/biurad/php-http-galaxy) |
9 | | -[](https://codecov.io/gh/biurad/php-http-galaxy) |
10 | | -[](https://scrutinizer-ci.com/g/biurad/php-http-galaxy) |
| 5 | +[](https://packagist.org/packages/biurad/http-galaxy) |
| 6 | +[](https://github.com/biurad/poakium/actions?query=workflow) |
| 7 | +[](LICENSE) |
| 8 | +[](https://github.com/biurad/poakium) |
11 | 9 |
|
12 | 10 | </div> |
13 | 11 |
|
14 | 12 | --- |
15 | 13 |
|
16 | | -**biurad/http-galaxy** is a fast, and simple [PSR-7] implementation for [PHP] 7.2+ based on [symfony/http-foundation] created by [Divine Niiquaye][@divineniiquaye]. This library seeks to add [PSR-7] support directly to [symfony/http-foundation] allowing the developer accessing both objects in one. It also shipped with [PSR-15] and [PSR-17] support. |
| 14 | +A [PHP][1] library that designed to provide [PSR-7][2], [PSR-15][3] and [PSR-17][4] seamless integration with [symfony/http-foundation][5] for your projects. |
17 | 15 |
|
18 | | -## 📦 Installation & Basic Usage |
| 16 | +## 📦 Installation |
19 | 17 |
|
20 | | -This project requires [PHP] 7.3 or higher. The recommended way to install, is via [Composer]. Simply run: |
| 18 | +This project requires [PHP][1] 7.4 or higher. The recommended way to install, is via [Composer][6]. Simply run: |
21 | 19 |
|
22 | 20 | ```bash |
23 | 21 | $ composer require biurad/http-galaxy |
24 | 22 | ``` |
25 | 23 |
|
26 | | -## 📓 Documentation |
27 | | - |
28 | | -For in-depth documentation before using this library.. Full documentation on advanced usage, configuration, and customization can be found at [docs.biurad.com][docs]. |
29 | | - |
30 | | -## ⏫ Upgrading |
31 | | - |
32 | | -Information on how to upgrade to newer versions of this library can be found in the [UPGRADE]. |
33 | | - |
34 | | -## 🏷️ Changelog |
35 | | - |
36 | | -[SemVer](http://semver.org/) is followed closely. Minor and patch releases should not introduce breaking changes to the codebase; See [CHANGELOG] for more information on what has changed recently. |
37 | | - |
38 | | -Any classes or methods marked `@internal` are not intended for use outside of this library and are subject to breaking changes at any time, so please avoid using them. |
39 | | - |
40 | | -## 🛠️ Maintenance & Support |
41 | | - |
42 | | -(This policy may change in the future and exceptions may be made on a case-by-case basis.) |
43 | | - |
44 | | -- A new **patch version released** (e.g. `1.0.10`, `1.1.6`) comes out roughly every month. It only contains bug fixes, so you can safely upgrade your applications. |
45 | | -- A new **minor version released** (e.g. `1.1`, `1.2`) comes out every six months: one in June and one in December. It contains bug fixes and new features, but it doesn’t include any breaking change, so you can safely upgrade your applications; |
46 | | -- A new **major version released** (e.g. `1.0`, `2.0`, `3.0`) comes out every two years. It can contain breaking changes, so you may need to do some changes in your applications before upgrading. |
47 | | - |
48 | | -When a **major** version is released, the number of minor versions is limited to five per branch (X.0, X.1, X.2, X.3 and X.4). The last minor version of a branch (e.g. 1.4, 2.4) is considered a **long-term support (LTS) version** with lasts for more that 2 years and the other ones cam last up to 8 months: |
49 | | - |
50 | | -**Get a professional support from [Biurad Lap][] after the active maintenance of a released version has ended**. |
51 | | - |
52 | | -## 🧪 Testing |
53 | | - |
54 | | -```bash |
55 | | -$ ./vendor/bin/phpunit |
| 24 | +## 📍 Quick Start |
| 25 | + |
| 26 | +Since [symfony/http-foundation][5] library is a standard on it's own, libraries which relies on PHP-FIG standard makes it difficult to integrate with. With this library you can safely use PHP-FIG standards with good performance. build quickly using HTTP Galaxy. |
| 27 | + |
| 28 | +Here is an example of how to use the library: |
| 29 | + |
| 30 | +```php |
| 31 | +use Biurad\Http\Factory\Psr17Factory; |
| 32 | +use Biurad\Http\Middlewares\PrepareResponseMiddleware; |
| 33 | +use Biurad\Http\Response; |
| 34 | +use Laminas\Stratigility\Middleware\CallableMiddlewareDecorator; |
| 35 | +use Laminas\Stratigility\MiddlewarePipe; |
| 36 | +use Psr\Http\Message\{ResponseInterface, ServerRequestInterface}; |
| 37 | +use Psr\Http\Server\RequestHandlerInterface; |
| 38 | + |
| 39 | +// Create a PSR-7 Request |
| 40 | +$request = Psr17Factory::fromGlobalRequest(); |
| 41 | + |
| 42 | +// Create a PSR-15 Request Handler |
| 43 | +$dispatcher = new MiddlewarePipe(); |
| 44 | +$dispatcher->pipe(new PrepareResponseMiddleware()); |
| 45 | +$dispatcher->pipe( |
| 46 | + new CallableMiddlewareDecorator( |
| 47 | + function (ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { |
| 48 | + // Apply middleware logic here |
| 49 | + return $handler->handle($request); |
| 50 | + } |
| 51 | + ) |
| 52 | +); |
| 53 | + |
| 54 | +// A request handler handling application's logic |
| 55 | +$handler = new \App\MyRequestHandler(); |
| 56 | + |
| 57 | +// Process the request handler and middleware(s) |
| 58 | +$response = $dispatcher->process($request, $handler); |
| 59 | +\assert($response instanceof Response); |
| 60 | + |
| 61 | +// Send the response to the client from symfony's response object |
| 62 | +$response->getResponse()->send(); |
56 | 63 | ``` |
57 | 64 |
|
58 | | -This will tests biurad/http-galaxy will run against PHP 7.3 version or higher. |
59 | | - |
60 | | -## 🏛️ Governance |
61 | | - |
62 | | -This project is primarily maintained by [Divine Niiquaye Ibok][@divineniiquaye]. Contributions are welcome 👷♀️! To contribute, please familiarize yourself with our [CONTRIBUTING] guidelines. |
| 65 | +## 📓 Documentation |
63 | 66 |
|
64 | | -To report a security vulnerability, please use the [Biurad Security](https://security.biurad.com). We will coordinate the fix and eventually commit the solution in this project. |
| 67 | +In-depth documentation on how to use this library can be found at [docs.biurad.com][7]. It is also recommended to browse through unit tests in the [tests](./tests/) directory. |
65 | 68 |
|
66 | 69 | ## 🙌 Sponsors |
67 | 70 |
|
68 | | -Are you interested in sponsoring development of this project? Reach out and support us on [Patreon](https://www.patreon.com/biurad) or see <https://biurad.com/sponsor> for a list of ways to contribute. |
| 71 | +If this library made it into your project, or you interested in supporting us, please consider [donating][8] to support future development. |
69 | 72 |
|
70 | 73 | ## 👥 Credits & Acknowledgements |
71 | 74 |
|
72 | | -- [Divine Niiquaye Ibok][@divineniiquaye] |
73 | | -- [All Contributors][] |
| 75 | +- [Divine Niiquaye Ibok][9] is the author this library. |
| 76 | +- [All Contributors][10] who contributed to this project. |
74 | 77 |
|
75 | 78 | ## 📄 License |
76 | 79 |
|
77 | | -The **biurad/http-galaxy** library is copyright © [Divine Niiquaye Ibok](https://divinenii.com) and licensed for use under the [](LICENSE). |
78 | | - |
79 | | -[PHP]: https://php.net |
80 | | -[PSR-7]: http://www.php-fig.org/psr/psr-7/ |
81 | | -[PSR-15]: http://www.php-fig.org/psr/psr-15/ |
82 | | -[PSR-17]: http://www.php-fig.org/psr/psr-17/ |
83 | | -[symfony/http-foundation]: https://github.com/symfony/http-foundation |
84 | | -[@divineniiquaye]: https://github.com/divineniiquaye |
85 | | -[docs]: https://docs.biurad.com/php/http-galaxy |
86 | | -[commit]: https://commits.biurad.com/flight-routing.git |
87 | | -[UPGRADE]: UPGRADE.md |
88 | | -[CHANGELOG]: CHANGELOG.md |
89 | | -[CONTRIBUTING]: ./.github/CONTRIBUTING.md |
90 | | -[All Contributors]: https://github.com/divineniiquaye/php-rade/contributors |
91 | | -[Biurad Lap]: https://team.biurad.com |
92 | | -[email]: support@biurad.com |
93 | | -[message]: https://projects.biurad.com/message |
| 80 | +Poakium HTTP Galaxy is completely free and released under the [BSD 3 License](LICENSE). |
| 81 | + |
| 82 | +[1]: https://php.net |
| 83 | +[2]: http://www.php-fig.org/psr/psr-7/ |
| 84 | +[3]: http://www.php-fig.org/psr/psr-15/ |
| 85 | +[4]: http://www.php-fig.org/psr/psr-17/ |
| 86 | +[5]: https://github.com/symfony/http-foundation |
| 87 | +[6]: https://getcomposer.org |
| 88 | +[7]: https://docs.biurad.com/poakium/http-galaxy |
| 89 | +[8]: https://biurad.com/sponsor |
| 90 | +[9]: https://github.com/divineniiquaye |
| 91 | +[10]: https://github.com/biurad/php-http-galaxy/contributors |
0 commit comments