evilfreelancer / bookeo-api-php
Bookeo API PHP7 client
Fund package maintenance!
Patreon
Installs: 5 879
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 6
Forks: 2
Open Issues: 0
Requires
- php: >=7.1
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^7.0.1
Requires (Dev)
- orchestra/testbench: ^3.0
- phpunit/phpunit: ^7.0
- vlucas/phpdotenv: ^3.6
README
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);