firelike / itunes-api
Zend Framework module to consume iTunes APIs
v1.0.3
2017-03-02 17:07 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-11-09 20:28:28 UTC
README
Introduction
Laminas/Zend Framework module to consume iTunes API
Installation
Install the module using Composer into your application's vendor directory. Add the following line to your
composer.json
.
{ "require": { "firelike/itunes-api": "^1.0" } }
Configuration
Enable the module in your application.config.php
file.
return array( 'modules' => array( 'Firelike\ITunes' ) );
Copy and paste the itunes.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 itunes.local.php
might look something like the following:
<?php return [ 'itunes_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\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);
Using the console:
php public/index.php itunes search -v
Implemented Service Methods:
- search
- lookup
- feed
- availableFeeds
- genres