PHP code example of littlesqx / douban-book
1. Go to this page and download the library: Download littlesqx/douban-book library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
littlesqx / douban-book example snippets
use Littlesqx\Book\Application;
// init app
$app = new Application();
// For laravel
// $app = app('douban-book');
// book's isbn10/isbn13 code
$isbn = '9787115473899';
// get a book entity
try {
$book = $app->getBook($isbn);
// use as an array
$book->toArray();
// or get json format
$book->toJSON();
// also, get property directly is allowed
$book->getTitle();
$book->getPrice();
} catch (\Exception $exception) {
// handle exception
}