Download the PHP package x-fran/g-trends without Composer
On this page you can find all versions of the php package x-fran/g-trends. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download x-fran/g-trends
More information about x-fran/g-trends
Files in x-fran/g-trends
Package g-trends
Short Description Google Trends API for PHP
License MIT
Homepage https://tarlabs.es/
Informations about the package g-trends
g-trends
Google Trends API for PHP
Introduction
This is an unofficial Google Trends API for PHP.
Please notice that the good functionality of this API depends on Google's willing to keep the backward compatibility and/or the parameters, naming and/or required values.
If this happens, feel free to contribute or open an issue.
Requirements
PHP 8.3 or higher. Please see the composer.json file.
Status (September 2026)
Google retired the dailytrends and realtimetrends endpoints in 2025. Since 5.0 this library
reads Google's "Trending Now" page instead, which returns richer data (search volume, growth,
related queries, topics). The explore-based methods (interest over time, related queries, related
topics, compared geo) and the pickers (suggestions, categories, geo) still work.
5.0 is a rewrite with a new API — see Usage below. It requires PHP 8.3+.
Installation
Via Composer (require)
If you have composer installed globally
If you use composer.phar local
Via Composer (create-project)
You can use the create-project command from Composer
to create the project in one go (you need to install composer):
Via Git (clone)
First, clone the repository:
At this point, you need to use Composer to install dependencies. Assuming you already have Composer:
Demo
Open index.php in a browser (or php -S localhost:8000) to see the output of every method.
Usage
Create a client
Every method throws XFran\GTrends\GTrendsException when Google answers with a non-200 status
(HTTP 429 = rate limited) or an unexpected payload, and InvalidArgumentException for bad arguments.
Trending Now
Google retired the dailytrends and realtimetrends endpoints in 2025. getTrendingNow() reads
the list behind trends.google.com/trending instead.
Explore (interest over time, related queries, related topics, compared geo)
Up to 5 keywords per call.
The widget payloads are returned exactly as Google sends them.
Pickers
Development
Caveats
- This is not an official or supported API; every endpoint is undocumented and can change without notice
- Rate limits are not publicly known. Google throttles by IP: sustained explore use returns HTTP 429 and the block can persist for a while. Use the `proxy` option if you hit it
Credits
- Some ideas pulled from General Mills's Google Trends API for Python
All versions of g-trends with dependencies
ext-curl Version *
ext-json Version *
ext-simplexml Version *
laminas/laminas-http Version ^2.23
laminas/laminas-stdlib Version ^3.21