Skip to content

Releases: ray-di/Ray.WebQuery

1.1.0

Choose a tag to compare

@koriym koriym released this 25 Jun 07:50

Added

  • Map web API responses to typed domain objects (BDR read pattern). #[WebQuery] gains type ('row' | 'row_list') and factory parameters, mirroring #[DbQuery] (#5)
  • WebResponseMapper hydrates a decoded JSON response into objects via a DI-resolved factory (static or instance) or the return-type entity constructor, binding response keys to parameter names (#5)
  • PostFetchInterface / PostFetchContext to compose the mapped result into an aggregate return type through a static fromContext() named constructor (#5)
  • Dedicated exceptions InvalidWebEntityException, InvalidWebFactoryException, EntityWithoutConstructorException, and MissingResponseKeyException (#5)

Changed

  • Add phpdocumentor/reflection-docblock (^5.3 || ^6.0) as a runtime dependency, used to resolve entity types from @return docblocks (#5)

The raw array / string / PSR-7 MessageInterface return paths are unchanged, so this release is backward compatible.

1.0.1

Choose a tag to compare

@koriym koriym released this 24 Jun 15:43

Changed

  • Require stable ray/media-query (^1.0) instead of the pre-release constraint ^1.0.0-rc1 (#4)
  • Raise the minimum PHP version to 8.2 to match ray/media-query's stable requirement (#4)

Fixed

  • Correct the package name (ray/web-query) and the usage examples in the README

1.0.0

Choose a tag to compare

@koriym koriym released this 24 Jun 15:29

First stable release.

Changed

  • Relax the rize/uri-template constraint to ^0.3 || ^0.4 so the package can be installed alongside packages that require rize/uri-template ^0.4 such as bear/resource 1.29+ and ray/aura-sql-module 1.17.x (#2)

Fixed

  • Make the web query test suite hermetic so it no longer depends on a live external schema URL (#3)

1.0.0-rc1

1.0.0-rc1 Pre-release
Pre-release

Choose a tag to compare

@koriym koriym released this 01 Aug 21:12
0998877

1.0.0-rc1

Initial Release

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.

Key Features

Web API Query System

  • #[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

Configuration Management

  • 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

HTTP Client Integration

  • 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

Architecture

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

Requirements

  • PHP 8.1+
  • Ray.MediaQuery 1.0.0-rc1
  • Guzzle HTTP 7.2+

Installation

composer require ray/web-query

Basic Usage

<?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}"
    }
  ]
}

Testing

This release includes comprehensive test coverage for all major functionality, ensuring reliability and stability for production use.

Dependencies

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

Next Steps

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.