germania-kg / mergequery_urifactory
URI factory decorator for merging query parameters
Installs: 25
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/germania-kg/mergequery_urifactory
Requires
- php: ^7.2|^8.0
- psr/http-factory: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- nyholm/psr7: ^1.3
- php-coveralls/php-coveralls: ^2.0
- phpspec/prophecy-phpunit: ^2.0
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-10-12 00:20:37 UTC
README
Germania KG ยท MergeQueryUriFactory
Installation
$ composer require germania-kg/mergequery_urifactory
Usage:
The MergeQueryUriFactoryDecorator adds a createUriMergeQuery method to any given PSR-17 UriFactory. It also itself implements Psr\Http\Message\UriFactoryInterface and can also be used as callable.
The createUriMergeQuery accepts both string and UriInterface URIs.
<?php use Germania\MergeQueryUriFactory\MergeQueryUriFactoryDecorator; use Nyholm\Psr7\Factory\Psr17Factory; $decoratee = new Psr17Factory(); $uri_factory = new MergeQueryUriFactoryDecorator( $decoratee ); // You know the UriFactoryInterface: $uri = $uri_factory->createUri( 'http://httpbin.org' ); // Programmatically merge query parameters, // either to a string or UriInterface: $uri2 = $uri_factory->createUriMergeQuery( 'http://httpbin.org', ['foo' => 'bar']); $uri3 = $uri_factory->createUriMergeQuery( $uri, ['foo' => 'bar']); echo $uri3; // http://httpbin.org?foo=bar