Download the PHP package concept-labs/http-message without Composer
On this page you can find all versions of the php package concept-labs/http-message. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download concept-labs/http-message
More information about concept-labs/http-message
Files in concept-labs/http-message
Informations about the package http-message
HTTP Message
A PSR-7 and PSR-17 compliant HTTP Message implementation for PHP 8.2+. This library provides a complete set of HTTP message abstractions following the PHP-FIG standards, designed to work seamlessly with the Singularity Container ecosystem.
Features
- ✅ PSR-7 Compliance: Full implementation of HTTP message interfaces
- ✅ PSR-17 Compliance: Complete set of HTTP factories
- ✅ Immutable Messages: All message modifications return new instances
- ✅ Stream Support: Robust stream handling for request/response bodies
- ✅ URI Handling: Complete URI manipulation and validation
- ✅ File Uploads: PSR-7 compliant uploaded file handling
- ✅ Server Requests: Full server-side request support
- ✅ Singularity Compatible: Designed for the Singularity Container ecosystem
- ✅ Fully Tested: Comprehensive test coverage with PEST
Installation
Requirements
- PHP 8.2 or higher
- PSR HTTP Message (psr/http-message)
- PSR HTTP Factory (psr/http-factory)
- Fig HTTP Message Utilities (fig/http-message-util)
Quick Start
Creating a Response
Creating a Request
Working with URIs
Working with Streams
Documentation
For detailed documentation, please refer to:
- Getting Started
- HTTP Messages
- Streams
- URIs
- Factories
- Server Requests
- File Uploads
- Singularity Integration
PSR-7 Components
Messages
Message- Base HTTP message implementationRequest- HTTP request implementationServerRequest- Server-side HTTP requestResponse- HTTP response implementation
Streams
Stream- PSR-7 stream implementationStreamFactory- Creates stream instances
URIs
Uri- URI implementation with validationUriFactory- Creates URI instances
Uploaded Files
UploadedFile- Uploaded file representationUploadedFileFactory- Creates uploaded file instancesUploadedFileNormalizer- Normalizes $_FILES array
PSR-17 Factories
All factory implementations follow PSR-17:
RequestFactory- Creates PSR-7 requestsResponseFactory- Creates PSR-7 responsesServerRequestFactory- Creates PSR-7 server requestsStreamFactory- Creates PSR-7 streamsUploadedFileFactory- Creates PSR-7 uploaded filesUriFactory- Creates PSR-7 URIs
Singularity Container Integration
This library is designed to work with the Singularity Container ecosystem. The concept.json configuration file defines service bindings for automatic dependency injection.
Key integration features:
- Shared Services: Factories are marked as shared (singletons)
- Prototype Services: Message objects are prototypes (new instance per request)
- Automatic Wiring: Container automatically resolves dependencies
See Singularity Integration for details.
Testing
The library includes comprehensive tests using PEST:
Architecture
SOLID Principles
The library follows SOLID principles:
- Single Responsibility: Each class has a focused purpose
- Open/Closed: Extensible through inheritance and composition
- Liskov Substitution: All implementations properly extend base interfaces
- Interface Segregation: Small, focused interfaces
- Dependency Inversion: Depends on abstractions, not concretions
Design Patterns
- Factory Pattern: PSR-17 factories for object creation
- Prototype Pattern: Message objects support cloning
- Immutable Objects: All message modifications return new instances
- Dependency Injection: Constructor-based dependency injection
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
This library is licensed under the MIT License. See LICENSE for details.
Credits
Developed by Viktor Halytskyi and the Concept Labs team.
Support
- 📧 Email: [email protected]
- 🐛 Issues: GitHub Issues
- 📖 Documentation: docs/
Related Projects
- Singularity Container - Dependency injection container
- PSR-7 - HTTP message interfaces
- PSR-17 - HTTP factories
All versions of http-message with dependencies
psr/http-message Version ^1
psr/http-factory Version ^1
fig/http-message-util Version ^1