PHP code example of evrenonur / google-play-scraper

1. Go to this page and download the library: Download evrenonur/google-play-scraper 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/ */

    

evrenonur / google-play-scraper example snippets


use GooglePlayScraper\GooglePlayScraper;

$scraper = new GooglePlayScraper();
$app = $scraper->app('com.google.android.apps.translate');

[
    'title' => 'Google Translate',
    'description' => 'Translate between 103 languages by typing...',
    'summary' => 'The world is closer than ever with over 100 languages',
    'installs' => '500,000,000+',
    'minInstalls' => 500000000,
    'maxInstalls' => 898626813,
    'score' => 4.482483,
    'scoreText' => '4.5',
    'ratings' => 6811669,
    'reviews' => 1614618,
    'histogram' => ['1' => 370042, '2' => 145558, '3' => 375720, '4' => 856865, '5' => 5063481],
    'price' => 0,
    'free' => true,
    'currency' => 'USD',
    'offersIAP' => false,
    'developer' => 'Google LLC',
    'developerId' => '5700313618786177705',
    'developerEmail' => '[email protected]',
    'developerWebsite' => 'http://support.google.com/translate',
    'privacyPolicy' => 'http://www.google.com/policies/privacy/',
    'genre' => 'Tools',
    'genreId' => 'TOOLS',
    'categories' => [
        ['name' => 'Tools', 'id' => 'TOOLS'],
    ],
    'icon' => 'https://lh3.googleusercontent.com/...',
    'headerImage' => 'https://lh3.googleusercontent.com/...',
    'screenshots' => ['https://lh3.googleusercontent.com/...'],
    'contentRating' => 'Everyone',
    'adSupported' => false,
    'updated' => 1576868577000,
    'version' => 'Varies with device',
    'appId' => 'com.google.android.apps.translate',
    'url' => 'https://play.google.com/store/apps/details?id=com.google.android.apps.translate&hl=en&gl=us',
]

use GooglePlayScraper\GooglePlayScraper;
use GooglePlayScraper\Enum\Collection;
use GooglePlayScraper\Enum\Category;

$scraper = new GooglePlayScraper();
$apps = $scraper->list(
    collection: Collection::TOP_FREE,
    category: Category::GAME_ACTION,
    num: 2,
);

[
    [
        'url' => 'https://play.google.com/store/apps/details?id=com.example.game',
        'appId' => 'com.example.game',
        'title' => 'Example Game',
        'summary' => 'An amazing game!',
        'developer' => 'Example Dev',
        'developerId' => '1234567890',
        'icon' => 'https://lh3.googleusercontent.com/...',
        'score' => 4.2,
        'scoreText' => '4.2',
        'price' => 0,
        'free' => true,
    ],
    // ...
]

use GooglePlayScraper\GooglePlayScraper;
use GooglePlayScraper\Enum\Price;

$scraper = new GooglePlayScraper();
$results = $scraper->search(
    term: 'whatsapp',
    num: 5,
    price: Price::FREE,
);

[
    [
        'url' => 'https://play.google.com/store/apps/details?id=com.whatsapp',
        'appId' => 'com.whatsapp',
        'title' => 'WhatsApp Messenger',
        'summary' => 'Simple. Reliable. Private.',
        'developer' => 'WhatsApp LLC',
        'developerId' => 'WhatsApp+LLC',
        'icon' => 'https://lh3.googleusercontent.com/...',
        'score' => 4.2,
        'scoreText' => '4.2',
        'price' => 0,
        'free' => true,
    ],
    // ...
]

$scraper = new GooglePlayScraper();

// By developer name
$apps = $scraper->developer(devId: 'Google LLC');

// By numeric ID
$apps = $scraper->developer(devId: '5700313618786177705');

[
    [
        'url' => 'https://play.google.com/store/apps/details?id=com.google.android.apps.translate',
        'appId' => 'com.google.android.apps.translate',
        'title' => 'Google Translate',
        'developer' => 'Google LLC',
        'icon' => 'https://lh3.googleusercontent.com/...',
        'score' => 4.5,
        'scoreText' => '4.5',
        'price' => 0,
        'free' => true,
    ],
    // ...
]

$scraper = new GooglePlayScraper();
$suggestions = $scraper->suggest('inst');

['instagram', 'instagram lite', 'instreet', 'instant apps', 'instapay']

use GooglePlayScraper\GooglePlayScraper;
use GooglePlayScraper\Enum\Sort;

$scraper = new GooglePlayScraper();

// Basic usage
$result = $scraper->reviews('com.whatsapp', sort: Sort::NEWEST, num: 10);

// Pagination
$page1 = $scraper->reviews('com.whatsapp', num: 10, paginate: true);
$page2 = $scraper->reviews(
    'com.whatsapp',
    num: 10,
    paginate: true,
    nextPaginationToken: $page1['nextPaginationToken'],
);

[
    'data' => [
        [
            'id' => 'gp:AOqpTOF...',
            'userName' => 'John Doe',
            'userImage' => 'https://lh3.googleusercontent.com/...',
            'date' => '2024-01-15T12:00:00.000Z',
            'score' => 5,
            'scoreText' => '5',
            'url' => 'https://play.google.com/store/apps/details?id=com.whatsapp&reviewId=gp:AOqpTOF...',
            'title' => 'Great app',
            'text' => 'Very reliable messaging application.',
            'replyDate' => '2024-01-16T10:00:00.000Z',
            'replyText' => 'Thanks for your feedback!',
            'version' => '2.24.1.6',
            'thumbsUp' => 42,
            'criterias' => [],
        ],
        // ...
    ],
    'nextPaginationToken' => 'CpEBCo4BCi...',
]

$scraper = new GooglePlayScraper();
$apps = $scraper->similar('com.whatsapp');

[
    [
        'url' => 'https://play.google.com/store/apps/details?id=org.telegram.messenger',
        'appId' => 'org.telegram.messenger',
        'title' => 'Telegram',
        'developer' => 'Telegram FZ-LLC',
        'icon' => 'https://lh3.googleusercontent.com/...',
        'score' => 4.3,
        'scoreText' => '4.3',
        'price' => 0,
        'free' => true,
    ],
    // ...
]

$scraper = new GooglePlayScraper();

// Detailed permissions
$permissions = $scraper->permissions('com.google.android.apps.translate');

// Short format
$short = $scraper->permissions('com.google.android.apps.translate', short: true);

[
    ['type' => 'Identity', 'permission' => 'find accounts on the device'],
    ['type' => 'Contacts', 'permission' => 'read your contacts'],
    ['type' => 'Photos/Media/Files', 'permission' => 'read the contents of your USB storage'],
    // ...
]

['Identity', 'Contacts', 'Photos/Media/Files', 'Camera', 'Microphone', 'Other']

$scraper = new GooglePlayScraper();
$safety = $scraper->dataSafety('com.google.android.apps.translate');

[
    'sharedData' => [
        [
            'data' => 'App activity',
            'optional' => false,
            'purpose' => 'App functionality, Analytics',
            'type' => 'App interactions',
        ],
        // ...
    ],
    'collectedData' => [
        [
            'data' => 'Personal info',
            'optional' => false,
            'purpose' => 'App functionality',
            'type' => 'Name',
        ],
        // ...
    ],
    'securityPractices' => [
        [
            'practice' => 'Data is encrypted in transit',
            'description' => 'Your data is transferred over a secure connection',
        ],
        // ...
    ],
    'privacyPolicyUrl' => 'http://www.google.com/policies/privacy/',
]

$scraper = new GooglePlayScraper();
$categories = $scraper->categories();

['APPLICATION', 'GAME', 'FAMILY', 'PHOTOGRAPHY', 'ENTERTAINMENT', 'COMMUNICATION', ...]

// HTTP proxy
$scraper = new GooglePlayScraper(proxy: 'http://proxy.example.com:8080');

// SOCKS5 proxy
$scraper = new GooglePlayScraper(proxy: 'socks5://proxy.example.com:1080');

// Authenticated proxy
$scraper = new GooglePlayScraper(proxy: 'http://user:[email protected]:8080');

// Change proxy at runtime
$scraper->setProxy('http://new-proxy.example.com:3128');
$scraper->setProxy(null); // Remove proxy

// Max 10 requests per 2 seconds
$scraper = new GooglePlayScraper(
    throttleLimit: 10,
    throttleInterval: 2000,
);

$scraper = new GooglePlayScraper(
    guzzleOptions: [
        'timeout' => 60,
        'verify' => false,
        'headers' => ['Accept-Language' => 'tr-TR'],
    ],
);

src/
├── GooglePlayScraper.php          # Main facade class
├── Enum/
│   ├── Age.php
│   ├── Category.php               # 53 app/game categories
│   ├── Collection.php             # TOP_FREE, TOP_PAID, GROSSING
│   ├── Permission.php
│   ├── Price.php                  # ALL, FREE, PAID
│   └── Sort.php                   # HELPFULNESS, NEWEST, RATING
├── Scraper/
│   ├── AppScraper.php             # App details
│   ├── CategoriesScraper.php      # Category listing
│   ├── DataSafetyScraper.php      # Data safety info
│   ├── DeveloperScraper.php       # Developer apps
│   ├── ListScraper.php            # Collection lists
│   ├── PermissionsScraper.php     # App permissions
│   ├── ReviewsScraper.php         # Reviews with pagination
│   ├── SearchScraper.php          # Search
│   ├── SimilarScraper.php         # Similar apps
│   └── SuggestScraper.php         # Search suggestions
└── Utils/
    ├── HttpClient.php             # Guzzle wrapper (proxy + throttle)
    ├── MappingHelper.php          # Data transformation helpers
    └── ScriptData.php             # HTML script tag parser