Skip to content

Commit 508694f

Browse files
committed
Update readme and add examples.
1 parent c6c2704 commit 508694f

8 files changed

Lines changed: 124 additions & 20 deletions

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
easybill PHP SDK
22
================
33

4+
[![Latest Stable Version](https://poser.pugx.org/easybill/php-sdk/v/stable.png)](https://packagist.org/packages/easybill/php-sdk) [![Total Downloads](https://poser.pugx.org/easybill/php-sdk/downloads.png)](https://packagist.org/packages/easybill/php-sdk) [![Latest Unstable Version](https://poser.pugx.org/easybill/php-sdk/v/unstable.png)](https://packagist.org/packages/easybill/php-sdk) [![License](https://poser.pugx.org/easybill/php-sdk/license.png)](https://packagist.org/packages/easybill/php-sdk)
5+
46
Switch SDK to [REST API](https://www.easybill.de/api/) **under development!**
57

6-
### Usage
8+
## Installation
9+
The recommended way of installing this library is using [Composer](http://getcomposer.org/).
10+
11+
Add this repository to your composer information using the following command
12+
13+
```bash
14+
composer require easybill/php-sdk
15+
```
16+
17+
## Usage
718

819
```php
920
use easybill\SDK\Client;
@@ -16,29 +27,18 @@ $result = $client->request('GET', 'documents');
1627
print_r($result);
1728
```
1829

19-
Output:
30+
## More examples
2031

21-
```
22-
Array
23-
(
24-
[page] => 1
25-
[pages] => 1
26-
[limit] => 100
27-
[total] => 1
28-
[items] => Array
29-
(
30-
[0] => Array
31-
(
32-
... truncated!
33-
)
34-
)
35-
)
36-
```
32+
Check the **examples** folder.
33+
34+
## Documentation
35+
36+
Please see https://www.easybill.de/api for up-to-date documentation.
3737

38-
### Contributing
38+
## Contributing
3939

4040
Please feel free to send bug reports and pull requests.
4141

42-
### License
42+
## License
4343

4444
Published as open source under the terms of [MIT License](http://opensource.org/licenses/MIT).
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
require_once '../vendor/autoload.php';
4+
5+
use easybill\SDK\Client;
6+
use easybill\SDK\Endpoint;
7+
8+
$client = new Client(new Endpoint('... your API key ...'));
9+
10+
$result = $client->request('GET', 'customers');
11+
12+
print_r($result);

examples/customers_02_create.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
require_once '../vendor/autoload.php';
4+
5+
use easybill\SDK\Client;
6+
use easybill\SDK\Endpoint;
7+
8+
$client = new Client(new Endpoint('... your API key ...'));
9+
10+
$result = $client->request('POST', 'customers', [
11+
'first_name' => 'Foo',
12+
'last_name' => 'Bar',
13+
'company_name' => 'FooBar GmbH',
14+
'emails' => [
15+
'foo.bar@foobar.com',
16+
],
17+
]);
18+
19+
print_r($result);

examples/customers_03_update.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
require_once '../vendor/autoload.php';
4+
5+
use easybill\SDK\Client;
6+
use easybill\SDK\Endpoint;
7+
8+
$client = new Client(new Endpoint('... your API key ...'));
9+
10+
$customer_id = '... your customer id ...';
11+
12+
$result = $client->request('PUT', 'customers/' . $customer_id, [
13+
'first_name' => 'Foo2',
14+
'last_name' => 'Bar2',
15+
'company_name' => 'FooBar GmbH2',
16+
]);
17+
18+
print_r($result);

examples/customers_04_delete.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
require_once '../vendor/autoload.php';
4+
5+
use easybill\SDK\Client;
6+
use easybill\SDK\Endpoint;
7+
8+
$client = new Client(new Endpoint('... your API key ...'));
9+
10+
$customer_id = '... your customer id ...';
11+
12+
$client->request('DELETE', 'customers/' . $customer_id);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
require_once '../vendor/autoload.php';
4+
5+
use easybill\SDK\Client;
6+
use easybill\SDK\Endpoint;
7+
8+
$client = new Client(new Endpoint('... your API key ...'));
9+
10+
$result = $client->request('GET', 'documents');
11+
12+
print_r($result);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
require_once '../vendor/autoload.php';
4+
5+
use easybill\SDK\Client;
6+
use easybill\SDK\Endpoint;
7+
8+
$client = new Client(new Endpoint('... your API key ...'));
9+
10+
$result = $client->request('GET', 'documents?' . http_build_query([
11+
'number' => '2000003338',
12+
])
13+
);
14+
15+
print_r($result);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
require_once '../vendor/autoload.php';
4+
5+
use easybill\SDK\Client;
6+
use easybill\SDK\Endpoint;
7+
8+
$client = new Client(new Endpoint('... your API key ...'));
9+
10+
$result = $client->request('GET', 'documents?' . http_build_query([
11+
'page' => '2',
12+
'limit' => 10,
13+
])
14+
);
15+
16+
print_r($result);

0 commit comments

Comments
 (0)