This PHP library provides an unofficial Google Play Store API
Copy the library
folder into your project.
First of all include the API.php
file into your PHP script:
include_once 'library/API.php';
Then you can create an PlayStoreApi object and configure it:
$api = new PlayStoreApi();
$api->setCountryCode("ES"); // Pass a valid 2 letters ISO country code (ISO 3166 alpha-2) (default: "US")
$api->setLanguageCode("es"); // Pass a valid 2 letters ISO language code (ISO 639-1) (default: "en")
And last you can search for any type of data available on the Play Store:
/*
* All of the following methods have the same structure
*
* @param $query string Term to search on the Google Play Store (mandatory)
* @param $page string PageToken of the page to load (if not set it'll load the first) (optional)
*/
$api->searchAlbums($query, $page);
$api->searchApps($query, $page);
$api->searchArtists($query, $page);
$api->searchBooks($query, $page);
$api->searchDevices($query, $page);
$api->searchMagazines($query, $page);
$api->searchMovies($query, $page);
$api->searchNewspapers($query, $page);
$api->searchSongs($query, $page);
$api->searchTvEpisodes($query, $page);
$api->searchTvShows($query, $page);
Every search method will return a json string formatted like the following:
{
"nextPageToken": "string with the pagetoken to load the next page of results",
"items": "array of objects with variable structure depending of the type of the data searched"
}
The structure of every type data are the following (all values are optional):
{
"album_id"
"image"
"title"
"artist"
"artist_id"
"price"
"url"
"description"
"genre"
"tracks"
"rating_value"
"rating_count"
}
{
"package"
"icon"
"name"
"developer"
"price"
"url"
"description"
"category"
"rating_value"
"rating_count"
"file_size"
"date_updated"
"num_downloads"
"version"
"required_android"
"content_rating"
}
{
"artist_id"
"image"
"name"
"url"
"about"
}
{
"book_id"
"image"
"title"
"author"
"price"
"url"
"description"
"pages"
"languages"
"isbn"
"rating_value"
"rating_count"
}
{
"device_id"
"image"
"title"
"price"
"url"
}
{
"magazine_id"
"image"
"title"
"price"
"url"
}
{
"movie_id"
"image"
"title"
"category"
"price"
"url"
}
{
"newspaper_id"
"image"
"title"
"price"
"url"
}
{
"album_id"
"song_id"
"image"
"title"
"artist"
"artist_id"
"price"
"url"
}
{
"episode_id"
"season_id"
"show_id"
"image"
"episode_title"
"show_title"
"date"
"price"
"url"
}
{
"show_id"
"image"
"title"
"category"
"price"
"url"
}
If the search doesn't return any result or the data type isn't available in the country configured the output will look like this:
{
"msg": "No results found"
}
- Add functionality to retrieve only an object based on their IDs
- Add methods to retrieve "Top charts" and "New arrivals" listings of every data type