Looking to hire Laravel developers? Try LaraJobs
This package is not available.

laravel-kitaboo-client maintained by thunderlane

Description
Kitaboo library for Laravel
Author
Last update
2019/09/21 17:07 (dev-master)
License
Links
Downloads
1
Tags

Comments
comments powered by Disqus

Build Status Total Downloads Latest Stable Version Latest Unstable Version License PhpStAn

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();
	}
}