firelike / litres-api
Zend Framework module to consume LitRes APIs
v1.0.0
2016-12-31 03:04 UTC
Requires
- php: ^5.6 || ^7.0
- guzzlehttp/guzzle-services: ^1.0
- zendframework/zend-log: ^2.9
- zendframework/zend-mvc-console: ^1.1
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2024-12-21 21:20:08 UTC
README
Introduction
Zend Framework module to consume LitRes API
Installation
Install the module using Composer into your application's vendor directory. Add the following line to your
composer.json
.
{ "require": { "firelike/litres-api": "^1.0" } }
Configuration
Enable the module in your application.config.php
file.
return array( 'modules' => array( 'Firelike\LitRes' ) );
Copy and paste the litres.local.php.dist
file to your config/autoload
folder and customize it with your credentials and
other configuration settings. Make sure to remove .dist
from your file.Your litres.local.php
might look something like the following:
<?php return [ 'litres_service' => [ 'log'=>[ 'enable'=>false, 'message_formats'=>[ '{method} {uri} HTTP/{version} {req_body}', 'RESPONSE: {code} - {res_body}', ], 'logger'=>[ 'stream' => 'php://output', ] ] ] ];
Usage
Calling from your code:
use Firelike\LitRes\Request\AbstractRequest; use Firelike\LitRes\Request\Browser as BrowserRequest; use Firelike\LitRes\Service\LitResService; $request = new BrowserRequest(); $request->setSearch('King') ->setLang('en') ->setLimit(25); $service = new LitResService(); $result = $service->browser($request); $numberOfRecords = $result->toArray()['results']; var_dump($numberOfRecords); $records= $result->toArray()['fb2-book']; var_dump($records);
Using the console:
php public/index.php litres browser --search=King -v
Implemented Service Methods:
- browser
- genres
- persons