https://github.com/vdhicts/http-query-builder
Replacement of http_build_query to allow the same parameter multiple times
https://github.com/vdhicts/http-query-builder
http php
Last synced: 3 months ago
JSON representation
Replacement of http_build_query to allow the same parameter multiple times
- Host: GitHub
- URL: https://github.com/vdhicts/http-query-builder
- Owner: vdhicts
- License: mit
- Created: 2021-08-05T05:45:06.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-23T14:05:53.000Z (8 months ago)
- Last Synced: 2025-10-26T22:10:18.229Z (5 months ago)
- Topics: http, php
- Language: PHP
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# http-query-builder
Replacement of `http_build_query` to allow the same parameter multiple times.
## Requirements
This package requires PHP 8.3 or higher.
## Installation
You can install the package via composer:
`composer require vdhicts/http-query-builder`
## Usage
The problem with the build-in `http_build_query` method is that it doesn't accept the same parameter multiple times as
it overwrites the key in the array. When you need to consume an API that uses those parameters (for example [FastAPI](https://fastapi.tiangolo.com/)
supports it), this package comes in handy.
### Getting started
```php
use Vdhicts\HttpQueryBuilder\Builder;
$builder = Builder::make()
->add('filter', 'a:1')
->add('filter', 'b:2');
echo $builder; // filter=a%3A1&filter=b%3A2
```
## Contributing
Found a bug or want to add a new feature? Great! There are also many other ways to make meaningful contributions such
as reviewing outstanding pull requests and writing documentation. Even opening an issue for a bug you found is
appreciated.
When you create a pull request, make sure it is tested, following the code standard (run `composer code-style:fix` to
take care of that for you) and please create one pull request per feature. In exchange, you will be credited as
contributor.
### Testing
To run the tests, you can use the following command:
```bash
composer test
```
### Security
If you discover any security related issues in this or other packages of Vdhicts!, please email security@vdhicts.nl
instead of using the issue tracker.