evilfreelancer/bookeo-api-php

Bookeo API PHP7 client

1.2.5 2021-11-14 16:59 UTC

This package is auto-updated.

Last update: 2022-05-15 06:53:51 UTC


README

Latest Stable Version Build Status Total Downloads License Code Climate Code Coverage Scrutinizer CQ

Bookeo API PHP7 client

composer require evilfreelancer/bookeo-api-php

Laravel framework support

Bookeo API client is optimized for usage as normal Laravel package, all functional is available via \BookeoApi facade, for access to client object you need instead:

$config = new \Bookeo\Config([
    'api_key'    => 'my-api-key',
    'secret_key' => 'my-secret-key'
]);
$bookeo = new \Bookeo\Client($config);

Use:

$bookeo = \BookeoApi::getClient();

You also may provide additional parameters to your client by passing array of parameters to getClient method:

$bookeo = \BookeoApi::getClient([
    'api_key'    => 'my-api-key',
    'secret_key' => 'my-secret-key'
]);

Laravel installation

Install the package via Composer:

composer require evilfreelancer/bookeo-api-php

By default the package will automatically register its service provider, but if you are a happy owner of Laravel version less than 5.3, then in a project, which is using your package (after composer require is done, of course), add intoproviders block of your config/app.php:

'providers' => [
    // ...
    Bookeo\Laravel\ClientServiceProvider::class,
],

Optionally, publish the configuration file if you want to change any defaults:

php artisan vendor:publish --provider="Bookeo\\Laravel\\ClientServiceProvider"

How to use

require_once __DIR__ . '/../vendor/autoload.php';

use \Bookeo\Client;
use \Bookeo\Models\MatchingSlotsSearchParameters;

$bookeo = new Client([
    'secret_key' => 'xxxxxxx',
    'api_key'    => 'xxxxxxxxxxxxxxxx'
]);

$result = $bookeo->availability->slots(null, '2019-09-16T00:00:00Z', '2019-09-18T23:59:59Z')->exec();
print_r($result);

$search = new MatchingSlotsSearchParameters();
$search->productId = 'unique-id-of-product';

$result = (string) $bookeo->availability->matching_slots->search($search)->exec();
print_r($result);

$result = (string) $bookeo->availability->matching_slots('pageNavigationToken', 1)->exec();
print_r($result);

Links