Skip to content

Commit

Permalink
Merge pull request #1 from sumocoders/http-client
Browse files Browse the repository at this point in the history
Http client
  • Loading branch information
tijsverkoyen committed Oct 13, 2021
2 parents d05bfc8 + be76c0f commit 5d11049
Show file tree
Hide file tree
Showing 10 changed files with 531 additions and 314 deletions.
12 changes: 0 additions & 12 deletions Exception.php

This file was deleted.

35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,41 @@ PHP DeFactuur is a (wrapper)class to communicate with [De Factuur](https://www.d

PHP DeFactuur is [BSD](http://classes.verkoyen.eu/overview/bsd) licensed.

## Initialisation

Using symfony/httpclient:

use Nyholm\Psr7\Factory\Psr17Factory;
use Symfony\Component\HttpClient\Psr18Client;

$deFactuur = new DeFactuur(
new Psr18Client(),
new Psr17Factory(),
new Psr17Factory(),
'your_api_token'
);

Using Guzzle:

$deFactuur = new \SumoCoders\DeFactuur\DeFactuur(
new \GuzzleHttp\Client(),
new \Nyholm\Psr7\Factory\Psr17Factory(),
new \Nyholm\Psr7\Factory\Psr17Factory(),
'your_api_token'
);

You can replace Psr17Factory with your own implementations of PSR-17's RequestFactoryInterface and StreamFactoryInterface.

## Using DeFactuur as a Service

Add the following to your services.yml:

SumoCoders\DeFactuur\DeFactuur:
arguments:
$apiToken: '%your.api.token%'

If you use auto-wiring, that's it!

## Documentation

Each method in the class is well documented using PHPDoc.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"php": ">=7.4.0",
"ext-curl": "*",
"ext-json": "*",
"symfony/http-client": "^5.3"
"psr/http-client": "^1.0",
"nyholm/psr7": "^1.4"
},
"suggest": {
"symfony/http-client": "Low-level HTTP-client"
},
"autoload": {
"psr-4": {"SumoCoders\\DeFactuur\\": "src"}
Expand Down
8 changes: 0 additions & 8 deletions src/Client/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

namespace SumoCoders\DeFactuur\Client;

/**
* Address class
*
* @author Tijs Verkoyen <php-factr@verkoyen.eu>
* @version 2.0.0
* @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
* @license BSD License
*/
class Address
{
protected string $country;
Expand Down
Loading

0 comments on commit 5d11049

Please sign in to comment.