Download the PHP package biblys/data-client-php without Composer
On this page you can find all versions of the php package biblys/data-client-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download biblys/data-client-php
More information about biblys/data-client-php
Files in biblys/data-client-php
Package data-client-php
Short Description Biblys Data PHP client library
License MIT
Homepage https://github.com/biblys/biblys-data-client-php
Informations about the package data-client-php
Biblys Data PHP client library
A PHP library to fetch data from or push data to Biblys Data.
Install
With composer:
Install with composer:
composer require biblys/data-client-php:~0
API
Client
$client = new Client(array options)
Initialize a new Biblys Data client.
Options:
apiKey
: optional when reading data from server, only required when pushing data to serverserver
: optional, defaults tohttp://data.biblys.fr
$client->getBook(string $isbn)
Get book infos from Biblys Data server for this ISBN.
Returns a Book
object if an object was found for this ISBN, returns false
otherwise.
$client->pushBook(Book $book)
Send the Book
object to server. Will test if there is already a book with
this ISBN with getBook()
. If there is, will use the updateBook()
method
to update it. Else, will use the createBook()
method to create it.
$client->createBook(Book $book)
Will try create the book on the server. Throws an exception if there is already a book with this ISBN.
$client->updateBook(Book $book)
Not yet implemented on the server (will fail silently).
$client->pushPublisher(Publisher $publisher)
Send the Publisher
object to server. Will test if there is already a book with
this id with getPublisher()
. If there is, will use the updatePublisher()
method
to update it. Else, will use the createPublisher()
method to create it.
$client->createPublisher(Publisher $publisher)
Will try create the book on the server. Throws an exception if there is already a book with this ISBN.
$client->updatePublisher(Publisher $publisher)
Not yet implemented on the server (will fail silently).
Book
$book = new Book()
Create a new Book
object
$book->setEan(string $isbn)
Set the book's ISBN. Throws an exception $isbn
is not a valid ISBN.
$book->getEan()
Get the book's ISBN.
$book->setTitle(string $title)
Set the book's title
$book->getTitle()
Get the book's title
$book->setPublisher(Publisher $publisher)
Associate a Publisher resource with the book
$book->getPublisher()
Get the book's publisher as a Publisher object
$book->setAuthors(array $authors)
Set the book's authors (must be an array of Contributor objects)
$book->addAuthor(Author $author)
Associate a Contributor with the book as an author
$book->getAuthors()
Get the book's authors as an array of Contributor objects
Contributor
Multiple contributors can be associated with book as authors. Other roles (illustrator, translator, etc.) will come later.
$contributor = new Contributor()
Create a new Contributor
object
$contributor->setId(string $id)
Set the contributor's id.
$contributor->getId()
Get the contributor's id.
$contributor->setFirstName(string $firstName)
Set the contributor's first name
$contributor->getFirstName()
Get the contributor's first name
$contributor->setLastName(string $lastName)
Set the contributor's last name
$contributor->getLastName()
Get the contributor's last name
$contributor->setName(string $name)
Set the contributor's full name (first + last names)
$contributor->getName()
Get the contributor's full name (first + last names)
Publisher
A publisher resource can be associated with a book.
$publisher = new Publisher()
Create a new Publisher
object
$publisher->setId(string $id)
Set the publisher's id.
$publisher->getId()
Get the publisher's id.
$publisher->setName(string $name)
Set the publisher's name
$publisher->getName()
Get the publisher's name
Examples
Get a book's infos from an ISBN
Push a book's infos to server
Test
Run tests with PHPUnit:
composer install
composer test
Changelog
0.3.0 (2016-04-05)
- Contributor push, create and get methods
- Books must be pushed with at least one Contributor as an author
0.2.1 (2016-03-25)
- Fixed getting Publisher with Book
- Require Publisher property when creating a Book
0.2.0 (2016-03-24)
- Publisher push, create and get methods
- Book must be pushed with a Publisher
0.1.0 (2016-03-05)
- First release
- Book push, create and get methods