https://github.com/f3-factory/fatfree-psr7
most lightweight PSR-7 / PSR-17 HTTP message implementation for PHP 8+
https://github.com/f3-factory/fatfree-psr7
http-message psr-17 psr-7
Last synced: 6 months ago
JSON representation
most lightweight PSR-7 / PSR-17 HTTP message implementation for PHP 8+
- Host: GitHub
- URL: https://github.com/f3-factory/fatfree-psr7
- Owner: f3-factory
- License: mit
- Created: 2022-10-19T08:48:30.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-09T20:21:12.000Z (9 months ago)
- Last Synced: 2025-05-07T06:57:50.335Z (6 months ago)
- Topics: http-message, psr-17, psr-7
- Language: PHP
- Homepage:
- Size: 38.1 KB
- Stars: 7
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fat-Free PSR-7 implementation
This is a lightweight [PSR-7](https://www.php-fig.org/psr/psr-7/) implementation for PHP 8.0+.
## Installation
```bash
composer require f3-factory/fatfree-psr7
```## Usage
The package includes a [PSR-17](https://www.php-fig.org/psr/psr-17/) factory.
Use these factories according to specs to create Request, Response, Uri, Stream objects.
## Tests
Run the test suite:
```bash
composer test
```NB: Custom tests were mostly taken from [Nyholm/psr7](https://github.com/Nyholm/psr7).
## Benchmarks
Benchmarks done with `devanych/psr-http-benchmark` on php 8.0+.
Checkout `benchmark` branch, start docker composer, then run in container:
```
COMPOSER_ROOT_VERSION=1.0 composer update
```Run benchmarks on php 8.0+:
```
cd benchmark/
php benchmark.php fatfree 50000
```## Test results (best of 3 on MacBook M2 Pro)
| Runs: 50,000 | Guzzle | HttpSoft | Laminas | Nyholm | Slim | Fatfree |
|----------------------|-----------|-----------|-----------|-----------|-----------|-----------|
| Runs per second | 14412 | 18608 | 17641 | 20549 | 14444 | 22233 |
| Average time per run | 0.0694 ms | 0.0537 ms | 0.0567 ms | 0.0487 ms | 0.0692 ms | 0.0450 ms |
| Total time | 3.4691 s | 2.6869 s | 2.8342 s | 2.4331 s | 3.4616 s | 2.2488 s |---