PHPackages                             gt-tech/gnews-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. gt-tech/gnews-api

ActiveLibrary[API Development](/categories/api)

gt-tech/gnews-api
=================

GNews API package for laravel

v1.0(4y ago)134MITPHPPHP ^7.3|^8.0

Since Jun 19Pushed 4y ago2 watchersCompare

[ Source](https://github.com/TsachreliasTech/gnews-api)[ Packagist](https://packagist.org/packages/gt-tech/gnews-api)[ Docs](https://github.com/TsachreliasTech/gnews-api)[ RSS](/packages/gt-tech-gnews-api/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Laravel GNews API
-----------------

[](#laravel-gnews-api)

A PHP client for the [GNews API](https://gnews.io/docs/v4#introduction).

### Installation

[](#installation)

You can install GNews API by using [Composer](https://getcomposer.org/)

You can use the following composer command to install it into an existing laravel project.

```
composer require gt-tech/gnews-api

```

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

[](#publish-the-configuration-file)

You can publish the configuration file of GNews API by running the following command:

```
php artisan vendor:publish --provider="ErgonautTM\GNewsApi\GNewsApiServiceProvider" --tag="config"

```

### Usage

[](#usage)

After installation and publish configuration file in your project,

Get Your API key from [here](https://gnews.io/dashboard)

```
use ErgonautTM\GNewsApi\GNewsApi;
.
.
.
$newsapi = new GNewsApi();
```

### Get TopHeadLines

[](#get-topheadlines)

```
$newsapi->getTopHeadLines($q, $topic, $from, $to, $max, $country, $lang);
```

ParameterDefaultDescription$qNoneKeep articles that matched keywords.$topicbreaking-newsSet the articles topic. Topics available are **breaking-news**, **world**, **nation**, **business**, **technology**, **entertainment**, **sports**, **science** and **health**.$fromNoneKeep articles with a publication date greater than or equal to the given date. ISO 8601 format (e.g. 2021-06-19T07:32:32Z)$toNoneKeep articles with a publication date less than or equal to the given date. ISO 8601 format (e.g. 2021-06-19T07:32:32Z)$max10Set 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).$countrygrSet the country of returned articles. See countries list in config file.$langelSet the language of returned articles. See languages list in config file.### Get Search

[](#get-search)

```
$newsapi->getSearch($q, $from, $to, $sort_by, $max, $country, $lang);
```

ParameterDefaultDescription$qNoneKeep articles that matched keywords.$fromNoneKeep articles with a publication date greater than or equal to the given date. ISO 8601 format (e.g. 2021-06-19T07:32:32Z)$toNoneKeep articles with a publication date less than or equal to the given date. ISO 8601 format (e.g. 2021-06-19T07:32:32Z)$sort\_bypublishedAtSet 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)$max10Set 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).$countrygrSet the country of returned articles. See countries list in config file.$langelSet the language of returned articles. See languages list in config file.### Get Countries

[](#get-countries)

Returns an array of allowed countries

```
$newsapi->getCountries();
```

### Get Languages

[](#get-languages)

Returns an array of allowed languages

```
$newsapi->getLanguages();
```

### Get Topics

[](#get-topics)

Returns an array of allowed topics

```
$newsapi->getTopics();
```

### Get SortBy

[](#get-sortby)

Returns an array of allowed sorts

```
$newsapi->getSortBy();
```

### CONTRIBUTORS

[](#contributors)

This package is authored by [George Tsachrelias](https://g-tsachrelias.com).

### TODO

[](#todo)

- PHP Unit Test

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1793d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b70bd75061eb91aac75afe00f3a42cd3ea79d328c679220e76ec59a8f4e7dca2?d=identicon)[giorgosstab](/maintainers/giorgosstab)

---

Top Contributors

[![giorgosstab](https://avatars.githubusercontent.com/u/17095088?v=4)](https://github.com/giorgosstab "giorgosstab (8 commits)")

---

Tags

apigt-techgnews

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gt-tech-gnews-api/health.svg)

```
[![Health](https://phpackages.com/badges/gt-tech-gnews-api/health.svg)](https://phpackages.com/packages/gt-tech-gnews-api)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
