Download the PHP package atomescrochus/laravel-itunes-search-api without Composer
On this page you can find all versions of the php package atomescrochus/laravel-itunes-search-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download atomescrochus/laravel-itunes-search-api
More information about atomescrochus/laravel-itunes-search-api
Files in atomescrochus/laravel-itunes-search-api
Package laravel-itunes-search-api
Short Description Easily search the iTunes API, with rate limiting awareness and caching support.
License MIT
Homepage https://github.com/atomescrochus/laravel-itunes-search-api
Informations about the package laravel-itunes-search-api
laravel-itunes-store-api
Here is to have a simple way to interact with the iTunes Store API from a Laravel >= 5.3 app.
This package is usable in production, but should still be considered as a work in progress. Found a bug? Got a feature request? Open an issue or better, send a PR!
Install
You can install this package via composer:
If you are on Laravel >=5.5, the package will be working with the auto-discovery feature. For earlier versions, you will have to install the package' service provider and alias:
You will have to publish the configuration files also if you want to change the default value:
Usage
Caching and iTunes Store API's rate limiting
Curently, the API is "limited to approximately 20 calls per minute (subject to change)". (Approximately!)
For now, the only way to know that you're on the rather erratic Store's rate limit is if we hit an HTTP response of 403 Forbidden
. There is no way to know when it expires, or how many call you have left, or anything usefull for that matter (yep, this sucks).
To help you manage the rate limiting, we provide a parameter to the result object returned by the search called rateLimited
. If set to true
, we encountered a 403
and it means that you are rate limited.
Of course, we cannot stop you from hitting the API even if you are rate limited, so it's your duty to make sure you stope for a little while if rateLimited
is set to true.
One last thing on rate limiting: since we usually cache results by default, if we ever encounter a 403
, we return an empty result without caching results, without consideration to the caching setting you could have set. This way, if you make the same call again within the normal caching time, but are not rate limited again, you won't get an empty result.
Results
In the example above, what is returned in $results
is an object containing: a collection of results; a count value for the results; a boolean to know if we are rate limited, a boolean to know if the result is coming from cached data, a boolean to know if we requested to search in the cache only, raw response data; and the unformatted query sent to the API.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Soon.
Contributing
Please see CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- [Jean-Philippe Murray][link-author]
- [All Contributors][link-contributors]
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-itunes-search-api with dependencies
php Version ~7.0
nategood/httpful Version ^0.2.20