thunderlane / laravel-kitaboo-client
Kitaboo library for Laravel
v0.1-alpha
2019-09-15 11:05 UTC
Requires
- php: >=7.1
- guzzlehttp/guzzle: ^6.3
- guzzlehttp/oauth-subscriber: 0.3.*
- guzzlehttp/psr7: ^1.5
- illuminate/support: ^5.5
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2025-03-22 04:02:32 UTC
README
Installation
composer require thunderlane/laravel-kitaboo-client
Setup
Add the following lines to your .env file:
KITABOO_CONTEXT_URL=https://kitaboo.endpoint
KITABOO_CLIENT_ID=<CLIENT ID>
KITABOO_CONSUMER_KEY=<CONSUMER KEY>
KITABOO_CONSUMER_SECRET=<CONSUMER SECRET>
Run
php artisan vendor:publish
Example usage
use Thunderlane\Kitaboo\KitabooInterface;
class YourController
{
/**
* @var Thunderlane\Kitaboo\KitabooInterface
*/
private $kitaboo;
public function __construct(KitabooInterface $kitaboo)
{
$this->kitaboo = $kitaboo;
}
/**
* @throws \Thunderlane\Kitaboo\Exceptions\UnknownEntityException
*/
public function yourAction()
{
$userService = $this->kitaboo->getReaderServices()->getUserService();
$userService->authenticateUser('USERNAME', 'PASSWORD');
$token = $userService->getCurrentUserToken();
$userService->setCurrentUserToken($token);
$user = $userService->getCurrentUser();
$userService->setCurrentUser($user);
$collectionService = $this->kitaboo->getExternalServices()->getCollectionService();
$collectionService->listCollection();
}
}