Skip to content

Commit

Permalink
Composer update + simple example added
Browse files Browse the repository at this point in the history
  • Loading branch information
danfekete committed Sep 17, 2019
1 parent 3fb6160 commit 3ff0faf
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"php": ">=7.1",
"guzzlehttp/guzzle": "^6.0",
"firebase/php-jwt": "^3.0",
"symfony/options-resolver": "^3.0",
"symfony/options-resolver": "4.*",
"ext-json": "*"
},
"autoload": {
Expand Down
30 changes: 30 additions & 0 deletions examples/example1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use Billingo\API\Connector\Exceptions\JSONParseException as JSONParseExceptionAlias;
use Billingo\API\Connector\Exceptions\RequestErrorException as RequestErrorExceptionAlias;
use Billingo\API\Connector\HTTP\Request as RequestAlias;
use GuzzleHttp\Exception\GuzzleException;

define("API_PUBLIC_KEY", "");
define("API_PRIVATE_KEY", "");

require_once "../vendor/autoload.php";

$request = new RequestAlias([
'private_key' => API_PRIVATE_KEY,
'public_key' => API_PUBLIC_KEY,
]);

try {

// Get list of clients
$clients = $request->get("clients");
var_dump($clients);

} catch (JSONParseExceptionAlias $e) {
echo "Error parsing response";
} catch (RequestErrorExceptionAlias $e) {
echo "Error in request";
} catch (GuzzleException $e) {
var_dump($e->getMessage());
}

0 comments on commit 3ff0faf

Please sign in to comment.