A Laravel client for the TiteLive / Epagine book directory API.
You can install the package via composer:
composer require code16/laravel-titelive-clientThe package will automatically register its service provider.
You can publish the config file with:
php artisan vendor:publish --tag="titelive-client-config"Add the following environment variables to your .env file:
TITELIVE_LOGIN=your_login
TITELIVE_PWD=your_password
TITELIVE_ENDPOINT=https://catsearch.epagine.fr/v1/
TITELIVE_LOGIN_ENDPOINT=https://login.epagine.fr/v1/To avoid making real API calls during development, you can enable the mock mode:
TITELIVE_CLIENT_MOCK_BOOK_DIRECTORY=trueThe SearchBooks action allows you to search for books in the TiteLive directory.
use Code16\LaravelTiteliveClient\Api\SearchBooks;
$results = app(SearchBooks::class)
->withUnavailable(false) // Filter for available books only (default is true)
->groupByEdition(true) // Group by edition (default is true)
->search('The Lord of the Rings', page: 1, count: 24);
foreach ($results as $book) {
echo $book->title;
}The FindBook action retrieves a specific book using its gencod.
use Code16\LaravelTiteliveClient\Api\FindBook;
$book = app(FindBook::class)->find('9780261102385');
if ($book) {
echo $book->title;
echo $book->editor;
}The API results are mapped to Code16\LaravelTiteliveClient\Models\Book Eloquent models (non-persisted by default).
Useful methods and attributes:
$book->canBeOrdered(): Checks if the book is available and has stock.$book->hasStock(): Checks if the book is currently in stock.$book->visual('large'): Retrieves a cover image URL for a given size.$book->shortDetails: A formatted string with authors and editor.
composer testThe MIT License (MIT). Please see License File for more information.