Ray.WebQuery 1.0.0-rc1 is the first release candidate of our new web API access mapping framework, extracted from Ray.MediaQuery to provide dedicated HTTP client functionality.
#[WebQuery]Annotation: Mark interface methods for automatic HTTP request mapping- Multiple Response Types: Support for JSON arrays, raw strings, and PSR-7 MessageInterface
- URI Template Support: Dynamic URL parameter binding using
{param}syntax - AOP Integration: Seamless method interception using Ray.Aop
- JSON Configuration: Define web APIs in structured JSON files
- Schema Validation: Complete JSON schema for web query definitions
- Template Bindings: Support for global URI template parameter bindings
- Guzzle HTTP Client: Built on the reliable Guzzle HTTP library
- PSR-7 Compatibility: Full support for PSR-7 HTTP message interfaces
- Parameter Injection: Automatic parameter conversion and injection
The framework follows a clean separation of concerns:
- MediaQueryWebModule: Dependency injection configuration
- WebQueryInterceptor: AOP-based method interception
- WebQueryConfig: Configuration loading and validation
- WebApiQuery: HTTP request execution
- PHP 8.1+
- Ray.MediaQuery 1.0.0-rc1
- Guzzle HTTP 7.2+
composer require ray/web-query<?php
use Ray\MediaQuery\Annotation\WebQuery;
interface ApiInterface
{
#[WebQuery('user.get')]
public function getUser(string $id): array;
}{
"webQuery": [
{
"id": "user.get",
"method": "GET",
"path": "https://api.example.com/users/{id}"
}
]
}This release includes comprehensive test coverage for all major functionality, ensuring reliability and stability for production use.
This package builds upon:
- ray/media-query 1.0.0-rc1 for core query functionality
- ray/di and ray/aop for dependency injection and AOP
- guzzlehttp/guzzle for HTTP client capabilities
- rize/uri-template for URI template processing
As a release candidate, we welcome feedback and testing from the community. The API is considered stable, but we may make minor adjustments based on user feedback before the final 1.0.0 release.