PHPackages                             atomescrochus/laravel-itunes-search-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. atomescrochus/laravel-itunes-search-api

AbandonedArchivedLibrary[API Development](/categories/api)

atomescrochus/laravel-itunes-search-api
=======================================

Easily search the iTunes API, with rate limiting awareness and caching support.

2.3.0(8y ago)103432[1 issues](https://github.com/atomescrochus/laravel-itunes-search-api/issues)MITPHPPHP ~7.0

Since Jan 13Pushed 8y ago3 watchersCompare

[ Source](https://github.com/atomescrochus/laravel-itunes-search-api)[ Packagist](https://packagist.org/packages/atomescrochus/laravel-itunes-search-api)[ Docs](https://github.com/atomescrochus/laravel-itunes-search-api)[ RSS](/packages/atomescrochus-laravel-itunes-search-api/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (12)Used By (0)

laravel-itunes-store-api
========================

[](#laravel-itunes-store-api)

Here is to have a simple way to interact with the iTunes Store API from a Laravel &gt;= 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
-------

[](#install)

You can install this package via composer:

```
$ composer require atomescrochus/laravel-itunes-search-api
```

If you are *on Laravel &gt;=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:

```
// config/app.php
'providers' => [
    ...
    Atomescrochus\ItunesStore\ItunesSearchAPIProvider::class,
];

// no need to add aliases, the packages bind itselfs as "ItunesSearch"
```

You will have to publish the configuration files also if you want to change the default value:

```
php artisan vendor:publish --provider="Atomescrochus\ItunesStore\ItunesSearchAPIProvider" --tag="config"
```

Usage
-----

[](#usage)

```
// here is an example query to search iTunes Store's API

// Set cache duration as an integer (number of minutes), can be 0
ItunesSearch::setCacheDuration(120) // optional, default is set in config

// You can execute a basic search, and hope for the best
$results = ItunesSearch::query("poker face lady gaga"); // limited to 15 results by default

// You can also send an optional array of other parameters supported by the API, for example
$results = ItunesSearch::query("poker face lady gaga", ['country' => 'CA', 'limit' => 10]);

// You can also execute a lookup (https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#lookup)
$results = ItunesSearch::lookup(902122445); // defaults to lookup by iTunes Store ID
$results = ItunesSearch::lookup(468749, 'amgArtistId') // you can do other type of lookups
$results = ItunesSearch::lookup("468749,909253", 'amgArtistId'); // you can also search for multiple ids like so

// And like the query() method, you can send an optional array of parameters
$results = ItunesSearch::lookup(909253, 'id', ['country' => 'CA', 'limit' => 10]);

// If you ever find yourself that you want to check your local cache for a result, without actually
// polling the Search API (for example, in cache you already know you've been rate limited):
$results = ItunesSearch::cacheOnly()->query("poker face lady gaga");
// if you want to poll again after setting cacheOnly(), you need to reverse the behavior
$results = ItunesSearch::cacheOnly(false)->lookup(909253);

// In case you only want to check if the query exists in the cache, without actually pulling the data:
$existInCache = ItunesSearch::inCache()->query("poker face lady gaga"); // returns boolean
$existInCache = ItunesSearch::inCache()->lookup(909253); // returns boolean
```

### Caching and iTunes Store API's rate limiting

[](#caching-and-itunes-store-apis-rate-limiting)

Curently, the API is "[limited to approximately 20 calls per minute (subject to change)](https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/)". (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

[](#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
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

Soon.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- \[Jean-Philippe Murray\]\[link-author\]
- \[All Contributors\]\[link-contributors\]

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 98.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~26 days

Recently: every ~58 days

Total

10

Last Release

3173d ago

Major Versions

0.0.1 → 1.0.22017-01-13

1.0.3 → 2.0.02017-01-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1550428?v=4)[Jean-Philippe Murray](/maintainers/jpmurray)[@jpmurray](https://github.com/jpmurray)

---

Top Contributors

[![jpmurray](https://avatars.githubusercontent.com/u/1550428?v=4)](https://github.com/jpmurray "jpmurray (62 commits)")[![vmitchell85](https://avatars.githubusercontent.com/u/1248035?v=4)](https://github.com/vmitchell85 "vmitchell85 (1 commits)")

---

Tags

apiitunes-apilaravellaravel-5-packagelaravel-packageapiitunesatomescrochuslaravel-itunes-search-apiitunes storeitunes seach

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/atomescrochus-laravel-itunes-search-api/health.svg)

```
[![Health](https://phpackages.com/badges/atomescrochus-laravel-itunes-search-api/health.svg)](https://phpackages.com/packages/atomescrochus-laravel-itunes-search-api)
```

###  Alternatives

[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[specialtactics/l5-api

Dependencies for the Laravel API Boilerplate package

3672.8k2](/packages/specialtactics-l5-api)[ardakilic/mutlucell

Mutlucell SMS API wrapper for sending sms text messages for Laravel

457.3k](/packages/ardakilic-mutlucell)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
