PHP code example of firelike / itunes-api

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


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


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

        use Firelike\ITunes\Request\AbstractRequest;
        use Firelike\ITunes\Request\Search as SearchRequest;
        use Firelike\ITunes\Service\ITunesService;

        
        $request = new SearchRequest();
        $request->setTerm('micheal connelly')
            ->setMedia('audiobook')
            ->setLimit(25);

        $service = new ITunesService();
        $result = $service->search($request);
        
        $numberOfRecords = $result->toArray()['resultCount'];
        var_dump($numberOfRecords);

        $records= $result->toArray()['results'];
        var_dump($records);
        

php public/index.php itunes search -v