Download the PHP package samuelfa/g-trends without Composer

On this page you can find all versions of the php package samuelfa/g-trends. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

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

Please see the composer.json file.

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

To see a demo output from all methods (okay, functions) please open in your favorite browser the index.php

Usage

New instance of the class GTrends

# This options are by default if none provided
$options = [
        'hl'  => 'en-US',
        'tz'  => -60, # last hour
        'geo' => 'IE',
    ];
$gt = new GTrends($options);

Interest Over Time

print_r($gt->interestOverTime('Dublin'));

Related Queries

# You can add up to 5 keywords
print_r( $gt->relatedQueries(['Dublin', 'Madrid', 'Paris']));

Trending Searches

# p54 is Google's tricky and wired code for Ireland
print_r($gt->trendingSearches('p54', date('Ymd')));

Interest by Subregion

# You can add up to 5 keywords
# Parameter $resolution (optional) for United States 'Subregion', 'Metro', 'City'
# Parameter $resolution (optional) for the rest of the countries 'Subregion', 'City' only
print_r($gt->relatedQueries(['Dublin'], 'City'));

Top Charts

# Parameters
# date '201708' for September 2017
# cid (category id) only able to choose from those listed on https://www.google.com/trends/topcharts
print_r($gt->topCharts('201708', 'basketball_players'));

Suggestions Autocomplete

print_r($gt->suggestionsAutocomplete('toys'));

Common API parameters

$keyWordList (Array)

Array of keywords (up to 5) to get data for

$category (Integer)

Search by category Please view this wiki page containing all available categories

$tz (Integer)

Timezone Offset For example US CST is

$time (String)

Timezone Offset

would get data from last hour (default)
would get data from today to 2 days ago
would get data from today to 3 months ago
would get data from today to 4 years ago

Caveats

- This is not an official or supported API
- Rate Limit is not publicly known, let me know if you have a consistent estimate.

Credits


All versions of g-trends with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
guzzlehttp/guzzle Version ^6.3
doctrine/collections Version ^1.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package samuelfa/g-trends contains the following files

Loading the files please wait ....