|
1 | | -# Fast Forward Framework |
| 1 | +# Fast Forward HTTP |
2 | 2 |
|
3 | 3 | [](LICENSE) |
4 | | -[](https://www.php.net/releases/) |
| 4 | +[](https://www.php.net/releases/) |
5 | 5 |
|
6 | | -**Fast Forward** is a lightweight and fast PHP framework designed for building modern web applications. |
7 | | -This package serves as an **aggregate metapackage**, bundling all http components of the Fast Forward ecosystem for easier installation and management. |
| 6 | +Fast Forward HTTP is the aggregate HTTP package of the Fast Forward ecosystem. |
8 | 7 |
|
9 | | ---- |
| 8 | +It is designed for developers who want a practical starting point for HTTP work without wiring each |
| 9 | +piece manually. Install one package, register one provider, and you get the default Fast Forward |
| 10 | +HTTP stack in your container. |
10 | 11 |
|
11 | | -## Features |
| 12 | +## What You Get |
12 | 13 |
|
13 | | -- 🚀 **Modern PHP 8.3+ syntax** |
14 | | -- ⚙️ Aggregates key components: |
15 | | - - [`fast-forward/http-message`](https://github.com/php-fast-forward/http-message) – PSR-7 compatible HTTP message implementation |
16 | | - - [`fast-forward/http-factory`](https://github.com/php-fast-forward/http-factory) – HTTP factory for creating PSR-7 request and response objects |
17 | | - - [`fast-forward/http-client`](https://github.com/php-fast-forward/http-client) – PSR-18 compatible HTTP client for making requests |
18 | | -- 📦 Simplifies installation of all http packages in one step |
19 | | -- 🧱 Provides a solid foundation for building scalable Http PHP applications |
20 | | - |
21 | | ---- |
| 14 | +- PSR-17 factories for requests, responses, server requests, streams, uploaded files, and URIs |
| 15 | +- A PSR-18 HTTP client backed by Symfony HttpClient |
| 16 | +- A `ServerRequestInterface` created from PHP globals |
| 17 | +- Fast Forward convenience factories for JSON, HTML, text, redirect, empty responses, and payload streams |
| 18 | +- One aggregate `HttpServiceProvider` that wires the stack together |
22 | 19 |
|
23 | 20 | ## Installation |
24 | 21 |
|
25 | | -Install via [Composer](https://getcomposer.org): |
26 | | - |
27 | 22 | ```bash |
28 | 23 | composer require fast-forward/http |
29 | 24 | ``` |
30 | 25 |
|
31 | | -This command will automatically pull in all the required dependencies of the framework. |
| 26 | +## Quickstart |
32 | 27 |
|
33 | | ---- |
| 28 | +```php |
| 29 | +<?php |
34 | 30 |
|
35 | | -## Requirements |
| 31 | +declare(strict_types=1); |
36 | 32 |
|
37 | | -- PHP 8.2 or higher |
| 33 | +use FastForward\Http\Message\Factory\ResponseFactoryInterface; |
| 34 | +use FastForward\Http\ServiceProvider\HttpServiceProvider; |
| 35 | +use function FastForward\Container\container; |
38 | 36 |
|
39 | | ---- |
| 37 | +$container = container(new HttpServiceProvider()); |
40 | 38 |
|
41 | | -## License |
| 39 | +$responseFactory = $container->get(ResponseFactoryInterface::class); |
| 40 | + |
| 41 | +$response = $responseFactory->createResponseFromPayload([ |
| 42 | + 'message' => 'Hello, Fast Forward HTTP!', |
| 43 | + 'ok' => true, |
| 44 | +]); |
| 45 | + |
| 46 | +echo $response->getHeaderLine('Content-Type'); |
| 47 | +// application/json; charset=utf-8 |
| 48 | +``` |
42 | 49 |
|
43 | | -Fast Forward Framework is licensed under the [MIT license](LICENSE). |
| 50 | +## Main Services |
44 | 51 |
|
45 | | ---- |
| 52 | +| Identifier | Default concrete service | Purpose | |
| 53 | +| --- | --- | --- | |
| 54 | +| `Psr\Http\Message\RequestFactoryInterface` | `Nyholm\Psr7\Factory\Psr17Factory` | Create outbound requests | |
| 55 | +| `Psr\Http\Message\ResponseFactoryInterface` | `Nyholm\Psr7\Factory\Psr17Factory` | Create plain PSR-17 responses | |
| 56 | +| `FastForward\Http\Message\Factory\ResponseFactoryInterface` | `FastForward\Http\Message\Factory\ResponseFactory` | Create JSON, HTML, text, redirect, and empty responses | |
| 57 | +| `FastForward\Http\Message\Factory\StreamFactoryInterface` | `FastForward\Http\Message\Factory\StreamFactory` | Create payload-aware JSON streams | |
| 58 | +| `Psr\Http\Message\ServerRequestInterface` | `ServerRequestCreator::fromGlobals()` result | Access the current incoming request | |
| 59 | +| `Psr\Http\Client\ClientInterface` | `Symfony\Component\HttpClient\Psr18Client` | Send outbound HTTP requests | |
46 | 60 |
|
47 | | -## Author |
| 61 | +## Documentation |
| 62 | + |
| 63 | +See the documentation sources in [`docs/`](docs/) for: |
| 64 | + |
| 65 | +- installation and quickstart |
| 66 | +- retrieving services from the container |
| 67 | +- responses, streams, and server requests |
| 68 | +- advanced customization and aliasing |
| 69 | +- aggregated services and compatibility notes |
| 70 | + |
| 71 | +## Related Packages |
| 72 | + |
| 73 | +- [`fast-forward/container`](https://github.com/php-fast-forward/container) |
| 74 | +- [`fast-forward/http-client`](https://github.com/php-fast-forward/http-client) |
| 75 | +- [`fast-forward/http-factory`](https://github.com/php-fast-forward/http-factory) |
| 76 | +- [`fast-forward/http-message`](https://github.com/php-fast-forward/http-message) |
| 77 | + |
| 78 | +## License |
48 | 79 |
|
49 | | -Developed with ❤️ by **Felipe Sayão Lobato Abreu** |
50 | | -📧 [github@mentordosnerds.com](mailto:github@mentordosnerds.com) |
| 80 | +Fast Forward HTTP is licensed under the [MIT license](LICENSE). |
0 commit comments