{"id":13405378,"url":"https://github.com/x-fran/g-trends","last_synced_at":"2025-03-14T09:32:50.170Z","repository":{"id":24681474,"uuid":"102232556","full_name":"x-fran/g-trends","owner":"x-fran","description":"Google Trends API for PHP","archived":false,"fork":false,"pushed_at":"2024-07-20T22:30:12.000Z","size":83,"stargazers_count":112,"open_issues_count":11,"forks_count":47,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-09-23T07:37:49.415Z","etag":null,"topics":["explore","google","google-api","google-trends","related-queries","trending","trending-search","trends"],"latest_commit_sha":null,"homepage":"https://tarlabs.es","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/x-fran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-03T01:04:44.000Z","updated_at":"2024-08-28T17:04:28.000Z","dependencies_parsed_at":"2023-01-14T01:25:09.286Z","dependency_job_id":null,"html_url":"https://github.com/x-fran/g-trends","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-fran%2Fg-trends","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-fran%2Fg-trends/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-fran%2Fg-trends/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-fran%2Fg-trends/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x-fran","download_url":"https://codeload.github.com/x-fran/g-trends/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221433020,"owners_count":16820145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["explore","google","google-api","google-trends","related-queries","trending","trending-search","trends"],"created_at":"2024-07-30T19:02:00.349Z","updated_at":"2024-10-25T19:32:10.133Z","avatar_url":"https://github.com/x-fran.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# g-trends\n\n\nGoogle Trends API for PHP\n=========================\n\n\nIntroduction\n------------\n\nThis is an unofficial Google Trends API for PHP.\n\nPlease 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.   \nIf this happens, feel free to contribute or open an issue.\n\n\nRequirements\n------------\n\nPlease see the [composer.json](composer.json) file.\n\n\nInstallation\n------------\n\n### Via Composer (require)\n\nIf you have composer installed globally\n```bash\n$ composer require x-fran/g-trends\n```\n\nIf you use composer.phar local\n```bash\n# Get your own copy of composer.phar\n$ curl -s https://getcomposer.org/installer | php -- --filename=composer\n$ composer require \"x-fran/g-trends\": \"^3.0\"\n```\n\n\n### Via Composer (create-project)\n\nYou can use the `create-project` command from [Composer](http://getcomposer.org/)\nto create the project in one go (you need to install [composer](https://getcomposer.org/doc/00-intro.md#downloading-the-composer-executable)):\n\n```bash\n$ curl -s https://getcomposer.org/installer | php -- --filename=composer\n$ composer --no-dev create-project x-fran/g-trends path/to/install\n```\n\n### Via Git (clone)\n\nFirst, clone the repository:\n\n```bash\n$ git clone https://github.com/x-fran/g-trends.git # optionally, specify the directory in which to clone\n$ cd path/to/install\n$ curl -s https://getcomposer.org/installer | php -- --filename=composer\n```\n\nAt this point, you need to use [Composer](https://getcomposer.org/) to install\ndependencies. Assuming you already have Composer:\n\n```bash\n$ composer --no-dev install\n```\n\nDemo\n----\n\nTo see a demo output from all methods (okay, functions) please open in your favorite browser the index.php \n\n\nUsage\n-----\n\n### New instance of the class GTrends\n    use Google\\GTrends;\n    \n    # This options are by default if none provided\n    $options = [\n        'hl' =\u003e 'en-US',\n        'tz' =\u003e 0,\n        'geo' =\u003e 'US',\n        'time' =\u003e 'all',\n        'category' =\u003e 0,\n    ];\n    $gt = new GTrends($options);\n\n## Set proxy to avoid google recaptcha\n\n    $gt = new GTrends($options);\n\n    $gt-\u003esetProxyConfigs([\n        'proxy_host' =\u003e 'your_proxy_host',\n        'proxy_port' =\u003e 8000,\n        'proxy_user' =\u003e 'your_proxy_user',\n        'proxy_pass' =\u003e 'your_proxy_pass',\n    ]);\n\n    $gt-\u003esetProxyConfigs(null); // clear proxy if you want\n\n### Interest Over Time\n\n    $gt-\u003egetInterestOverTime('Dublin');\n\n### Related Queries\n\n    $gt-\u003egetRelatedSearchQueries(['Donald Trump', 'Barack Obama']);\n    \n### Realtime Search Trends\n    # Categories for Realtime Search Trends are a single char str:\n    $gt-\u003egetRealTimeSearchTrends('all');\n    #\n    # Categories\n    # all : default\n    # b : business\n    # e : entertainment\n    # m : health/medical\n    # t : sci/tech\n    # s : sports\n    # h : top stories\n\n### Daily Search Trends\n    $gt-\u003egetDailySearchTrends();\n    \n### Trending Searches\n\n    # p54 is Google's tricky and wired code for Ireland\n    print_r($gt-\u003etrendingSearches('p54', date('Ymd')));\n    #\n    # National Region Codes:\n    # IRELAND=p54\n    # UNITED_STATES=p1\n    # ARGENTINA=p30\n    # AUSTRALIA=p8\n    # AUSTRIA=p44\n    # BELGIUM=p41\n    # BRAZIL=p18\n    # CANADA=p13\n    # CHILE=p38\n    # COLOMBIA=p32\n    # CZECHIA=p43\n    # DENMARK=p49\n    # EGYPT=p29\n    # FINLAND=p50\n    # FRANCE=p16\n    # GERMANY=p15\n    # GREECE=p48\n    # HONG_KONG=p10\n    # HUNGARY=p45\n    # INDIA=p3\n    # INDONESIA=p19\n    # ISRAEL=p6\n    # ITALY=p27\n    # JAPAN=p4\n    # KENYA=p37\n    # MALAYSIA=p34\n    # MEXICO=p21\n    # NETHERLANDS=p17\n    # NEW_ZEALAND=p53\n    # NIGERIA=p52\n    # NORWAY=p51\n    # PHILIPPINES=p25\n    # POLAND=p31\n    # PORTUGAL=p47\n    # ROMANIA=p39\n    # RUSSIA=p14\n    # SAUDI_ARABIA=p36\n    # SINGAPORE=p5\n    # SOUTH_AFRICA=p40\n    # SOUTH_KOREA=p23\n    # SPAIN=p26\n    # SWEDEN=p42\n    # SWITZERLAND=p46\n    # TAIWAN=p12\n    # THAILAND=p33\n    # TURKEY=p24\n    # UKRAINE=p35\n    # UNITED_KINGDOM=p9\n    # VIETNAM=p28\n\n### Suggestions Autocomplete\n\n    $gt-\u003esuggestionsAutocomplete('Milwaukee');\n\n## Common API parameters\n\n$keyWords (Array)\n\n\u003e Array of keywords (up to 5) to get data for\n\n$options['category'] (Integer)\n\n\u003e Search by category\n\u003e Please view this [wiki page containing all available categories](https://github.com/pat310/google-trends-api/wiki/Google-Trends-Categories)\n\n$options['tz']  (Integer)\n\n\u003e Timezone Offset\n\u003e For example US CST is ```360```\n\n$options['time'] (String)\n\n\u003e Timezone Offset \n\n\u003e **```'now 1-H'```** would get data from last hour  \n\u003e **```'now 1-d'```** would get data from last day  \n\u003e **```'today 2-d'```** would get data from today to 2 days ago  \n\u003e **```'today 3-m'```** would get data from today to 3 months ago  \n\u003e **```'today 4-y'```** would get data from today to 4 years ago  \n\n\nCaveats\n-------\n\n    - This is not an official or supported API\n    - Rate Limit is not publicly known, let me know if you have a consistent estimate.\n\n\nCredits\n-------\n\n* Some ideas pulled from General Mills's Google Trends API for Python\n    - https://github.com/GeneralMills/pytrends\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-fran%2Fg-trends","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx-fran%2Fg-trends","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-fran%2Fg-trends/lists"}