Download the PHP package gt-tech/gnews-api without Composer
On this page you can find all versions of the php package gt-tech/gnews-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gt-tech/gnews-api
More information about gt-tech/gnews-api
Files in gt-tech/gnews-api
Package gnews-api
Short Description GNews API package for laravel
License MIT
Homepage https://github.com/TsachreliasTech/gnews-api
Informations about the package gnews-api
Laravel GNews API
A PHP client for the GNews API.
Installation
You can install GNews API by using Composer
You can use the following composer command to install it into an existing laravel project.
Laravel will already register the service provider to your application because GNews API does make use of the extra laravel tag on the composer.json
schema
Publish the configuration file
You can publish the configuration file of GNews API by running the following command:
Usage
After installation and publish configuration file in your project,
Get Your API key from here
Get TopHeadLines
Parameter | Default | Description |
---|---|---|
$q | None | Keep articles that matched keywords. |
$topic | breaking-news | Set the articles topic. Topics available are breaking-news, world, nation, business, technology, entertainment, sports, science and health. |
$from | None | Keep articles with a publication date greater than or equal to the given date. ISO 8601 format (e.g. 2021-06-19T07:32:32Z) |
$to | None | Keep articles with a publication date less than or equal to the given date. ISO 8601 format (e.g. 2021-06-19T07:32:32Z) |
$max | 10 | Set the maximum number of articles returned per query. 100 is the maximum value. The maximum value allowed depend on your plan (FREE has 10, PLUS has 30 and PRO has 100). |
$country | gr | Set the country of returned articles. See countries list in config file. |
$lang | el | Set the language of returned articles. See languages list in config file. |
Get Search
Parameter | Default | Description |
---|---|---|
$q | None | Keep articles that matched keywords. |
$from | None | Keep articles with a publication date greater than or equal to the given date. ISO 8601 format (e.g. 2021-06-19T07:32:32Z) |
$to | None | Keep articles with a publication date less than or equal to the given date. ISO 8601 format (e.g. 2021-06-19T07:32:32Z) |
$sort_by | publishedAt | Set the order in which the items are sorted. (publishedAt: sort articles first according to the most recent date of publication, relevance: sort articles that most closely match the query) |
$max | 10 | Set the maximum number of articles returned per query. 100 is the maximum value. The maximum value allowed depend on your plan (FREE has 10, PLUS has 30 and PRO has 100). |
$country | gr | Set the country of returned articles. See countries list in config file. |
$lang | el | Set the language of returned articles. See languages list in config file. |
Get Countries
Returns an array of allowed countries
Get Languages
Returns an array of allowed languages
Get Topics
Returns an array of allowed topics
Get SortBy
Returns an array of allowed sorts
CONTRIBUTORS
This package is authored by George Tsachrelias.
TODO
- [ ] PHP Unit Test