PHP code example of firelike / litres-api

1. Go to this page and download the library: Download firelike/litres-api 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/ */

    

firelike / litres-api example snippets


return array(
    'modules' => array(
        'Firelike\LitRes'
    )
);


return [
    'litres_service' => [
        'log'=>[
            'enable'=>false,
            'message_formats'=>[
                '{method} {uri} HTTP/{version} {req_body}',
                'RESPONSE: {code} - {res_body}',
            ],
            'logger'=>[
                 'stream' => 'php://output',
            ]
        ]
    ]
];

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

php public/index.php litres browser --search=King -v