Skip to content

Commit

Permalink
Merge pull request #1 from niels-nijens/initial
Browse files Browse the repository at this point in the history
Initial HTTP client package
  • Loading branch information
niels-nijens authored Sep 11, 2019
2 parents e28f093 + 1d7dc17 commit ff48032
Show file tree
Hide file tree
Showing 15 changed files with 3,928 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor/
*.cache
13 changes: 13 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__);

return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'yoda_style' => null, // Do not enforce Yoda style (add unit tests instead...)
'ordered_imports' => true,
])
->setFinder($finder);
49 changes: 49 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
filter:
excluded_paths:
- 'tests/*'

dependency_paths:
- 'vendor/'

checks:
php: true

build:
dependencies:
before:
- restore-from-cache repository "dependencies"

override:
- composer install --no-interaction --optimize-autoloader
- command: wget https://get.symfony.com/cli/installer -O - | bash
only_if: '[ "$SCRUTINIZER_BRANCH" == "master" ] && [ -z "$SCRUTINIZER_PR_SOURCE_BRANCH" ]'

after:
- store-in-cache repository "dependencies" vendor/

nodes:
tests:
tests:
override:
- composer validate

- ./vendor/bin/php-cs-fixer fix --dry-run -v

- command: '~/.symfony/bin/symfony security:check --force-update'
only_if: '[ "$SCRUTINIZER_BRANCH" == "master" ] && [ -z "$SCRUTINIZER_PR_SOURCE_BRANCH" ]'

- command: './vendor/bin/phpunit --coverage-clover=coverage-clover.xml'
coverage:
file: 'coverage-clover.xml'
format: 'clover'

- php-scrutinizer-run

environment:
php:
version: '7.2'

build_failure_conditions:
- 'elements.rating(<= D).new.exists' # No new classes/methods with a rating of D or worse.
- 'project.metric("scrutinizer.quality", < 8)' # Code Quality Rating drops below 8.
- 'project.metric("scrutinizer.test_coverage", < 0.80)' # Code Coverage drops below 80%.
48 changes: 47 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,48 @@
# verbose-error-http-client
# Verbose error HTTP client

[![Latest version on Packagist][ico-version]][link-version]
[![Software License][ico-license]][link-license]
[![Build Status][ico-build]][link-build]
[![Coverage Status][ico-coverage]][link-coverage]
[![Code Quality][ico-code-quality]][link-code-quality]

Increased verbosity of error messages in the Symfony HTTP client.

## Installation using Composer
Run the following command to add the package to the composer.json of your project:

``` bash
$ composer require superbrave/verbose-error-http-client symfony/http-client
```

The `symfony/http-client` can be replaced with any other HTTP client implementing the Symfony HTTP client contracts.

## Usage
The following example shows how to create the instances required execute requests with verbose exception messages:
```php
<?php

use Superbrave\VerboseErrorHttpClient\VerboseErrorHttpClient;
use Symfony\Component\HttpClient\HttpClient;

$httpClient = HttpClient::create();
$verboseErrorHttpClient = new VerboseErrorHttpClient($httpClient);

$response = $verboseErrorHttpClient->request('GET', 'https://superbrave.nl/api');
```

## License
The Verbose error HTTP client is licensed under the MIT License. Please see the [LICENSE file][link-license]
for details.

[ico-version]: https://img.shields.io/packagist/v/superbrave/verbose-error-http-client
[ico-license]: https://img.shields.io/packagist/l/superbrave/verbose-error-http-client
[ico-build]: https://scrutinizer-ci.com/g/superbrave/verbose-error-http-client/badges/build.png?b=master
[ico-coverage]: https://scrutinizer-ci.com/g/superbrave/verbose-error-http-client/badges/coverage.png?b=master
[ico-code-quality]: https://scrutinizer-ci.com/g/superbrave/verbose-error-http-client/badges/quality-score.png?b=master

[link-version]: https://packagist.org/packages/superbrave/verbose-error-http-client
[link-license]: LICENSE
[link-build]: https://scrutinizer-ci.com/g/superbrave/verbose-error-http-client/build-status/master
[link-coverage]: https://scrutinizer-ci.com/g/superbrave/verbose-error-http-client/build-status/master
[link-code-quality]: https://scrutinizer-ci.com/g/superbrave/verbose-error-http-client/build-status/master
40 changes: 40 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "superbrave/verbose-error-http-client",
"description": "Increased verbosity of error messages in the Symfony HTTP client.",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Niels Nijens",
"email": "[email protected]"
}
],
"require": {
"php": "^7.2",
"symfony/http-client-contracts": "^1.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.15",
"phpunit/phpunit": "^8.3",
"symfony/http-client": "^4.3"
},
"suggest": {
"symfony/http-client": "This package requires an actual Symfony HTTP client implementation to decorate."
},
"provide": {
"symfony/http-client-implementation": "1.1"
},
"autoload": {
"psr-4": {
"Superbrave\\VerboseErrorHttpClient\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Superbrave\\VerboseErrorHttpClient\\Tests\\": "tests/"
}
},
"config": {
"sort-packages": true
}
}
Loading

0 comments on commit ff48032

Please sign in to comment.