Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .editorconfig

This file was deleted.

5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
about: Create a report to help us improve the package
title: ""
labels: bug
assignees: vdhicts

assignees: dvdheiden
---

## Describe the bug
Expand Down
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
---
name: Feature request
about: Suggest an idea for this project
about: Suggest an idea for this package
title: ""
labels: feature
assignees: vdhicts

assignees: dvdheiden
---

## Goal

A clear and concise description of what the problem is. Ex. I think this could be easier when...
A clear and concise description of which "problem" you want to get solved. Ex. I think this could be easier when...

## Additional information

Expand Down
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Changes

Provide a summary of your changes.

# Checks

- [ ] The changelog is updated (when applicable)
- [ ] The support Cluster API version is updated in the readme (when applicable)
45 changes: 25 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
name: http-query-builder
name: CI

on: [push]
on: [ push ]

jobs:
cluster-api-tests:
runs-on: ubuntu-latest
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '8.3', '8.4' ]

steps:
- name: Checkout
uses: actions/checkout@v1
name: PHP ${{ matrix.php-versions }}

- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: '7.4'
extensions: mbstring, intl
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl

- name: Execute tests (Unit and Feature tests) via PHPUnit
run: |
vendor/bin/phpunit
- name: Install composer dependencies
run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --no-progress

- name: Execute static analysis
run: |
vendor/bin/psalm
- name: Execute static analysis
run: composer analyse

- name: Execute tests via PHPUnit
run: composer test:no-coverage

- name: Check code style
run: composer code-style:check
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/vendor
composer.lock
/vendor/
/.idea/
/build/
/build
.phpunit.result.cache
.idea
.phpunit.cache
.DS_Store
.phpactor.json
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
cluster API. See the changelog of the [cluster API](https://cluster-api.cyberfusion.nl/redoc#section/Changelog) for
detailed information.

## [2.0.0]

### Added

- Add support for PHP 8.3+ and modernize code.
- Add test for parameters.
- Add PHPStan for static analysis.
- Add Pint for code style checks/enforcement.
- Add implementation of the `Stringable` interface.

### Changed

- Updated dependencies to their latest versions.

### Removed

- Remove psalm in favor of Pint.

## [1.0.0]

### [Added]
### Added

- Add initial version of the package
48 changes: 20 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,53 @@
# http-query-builder

Replacement of http_build_query to allow the same parameter multiple times.
Replacement of `http_build_query` to allow the same parameter multiple times.

## Requirements

This package requires PHP 7.4 or higher.
This package requires PHP 8.3 or higher.

## Installation

This package can be used in any PHP project or with any framework.

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.
When you need to consume an API that uses those parameters (for example [FastAPI](https://fastapi.tiangolo.com/)
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 = (new Builder())
$builder = Builder::make()
->add('filter', 'a:1')
->add('filter', 'b:2');
echo $builder; // filter=a%3A1&filter=b%3A2
```

## Tests

Unit tests are available in the `tests` folder. Run with:

`composer test`

When you want a code coverage report which will be generated in the `build/report` folder. Run with:
## Contributing

`composer test-coverage`
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.

## Contribution
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.

Any contribution is welcome, but it should meet the PSR-2 standard and please create one pull request per feature/bug.
In exchange, you will be credited as contributor on this page.
### Testing

## Security
To run the tests, you can use the following command:

If you discover any security related issues in this or other packages of Vdhicts, please email info@vdhicts.nl instead
of using the issue tracker.

## License

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
```bash
composer test
```

## About Vdhicts
### Security

[Vdhicts](https://www.vdhicts.nl) is the name of my personal company for which I work as freelancer. Vdhicts develops
and implements IT solutions for businesses and educational institutions.
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.
23 changes: 13 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{
"name": "vdhicts/http-query-builder",
"description": "Replacement of http_build_query to allow the same parameter multiple times ",
"description": "Replacement of http_build_query to allow the same parameter multiple times.",
"keywords": [
"http_build_query",
"query"
"query",
"builder"
],
"homepage": "https://github.com/vdhicts/http-query-builder",
"license": "MIT",
"authors": [
{
"name": "Dick van der Heiden",
"email": "info@vdhicts.nl",
"homepage": "https://www.vdhicts.nl",
"email": "dick@goedemiddag.nl",
"role": "Developer"
}
],
"require": {
"php": "^7.4 || ^8.0"
"php": "^8.3"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
"vimeo/psalm": "^4.4"
"laravel/pint": "^1.22",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^11.0"
},
"autoload": {
"psr-4": {
Expand All @@ -33,9 +34,11 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit --no-coverage",
"test-coverage": "vendor/bin/phpunit",
"analyse": "vendor/bin/psalm"
"analyse": "vendor/bin/phpstan analyse",
"code-style:check": "vendor/bin/pint --test",
"code-style:fix": "vendor/bin/pint",
"test": "vendor/bin/phpunit",
"test:no-coverage": "vendor/bin/phpunit --no-coverage"
},
"config": {
"sort-packages": true
Expand Down
6 changes: 6 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
paths:
- src/
- tests/
level: 6
treatPhpDocTypesAsCertain: false
23 changes: 23 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<coverage>
<report>
<html outputDirectory="build/coverage"/>
</report>
</coverage>
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
16 changes: 0 additions & 16 deletions phpunit.xml.dist

This file was deleted.

3 changes: 3 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"preset": "psr12"
}
15 changes: 0 additions & 15 deletions psalm.xml

This file was deleted.

Loading