Download the PHP package gnews-io/gnews-io-php without Composer
On this page you can find all versions of the php package gnews-io/gnews-io-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package gnews-io-php
GNews API PHP Client
A PHP client for GNews API, designed to be simple and easy to use.
Documentation
Installation
Usage
Initialization
Search Endpoint
Top Headlines Endpoint
Response Format
The API results are returned in an ArticleCollection object:
ArticleCollection
| Method | Description |
|---|---|
getTotalArticles() |
Returns the total number of available articles |
getArticles() |
Returns an array of Article objects |
count() |
Returns the number of articles in the collection |
| Array access | You can access articles with $articles[0] |
| Iteration | You can use foreach($articles as $article) |
Article
| Method | Description |
|---|---|
getId() |
Get the article ID (also accessible via ->id) |
getTitle() |
Get the article title (also accessible via ->title) |
getDescription() |
Get the article description (also accessible via ->description) |
getContent() |
Get the article content (also accessible via ->content) |
getUrl() |
Get the article URL (also accessible via ->url) |
getImage() |
Get the article image URL (also accessible via ->image) |
getPublishedAt() |
Get the publication date (also accessible via ->publishedAt) |
getSource() |
Get the complete source information array (also accessible via ->source) |
getSourceId() |
Get the source ID (also accessible via ->source['id']) |
getSourceName() |
Get the source name (also accessible via ->source['name']) |
getSourceUrl() |
Get the source URL (also accessible via ->source['url']) |
getSourceCountry() |
Get the source country of origin (also accessible via ->source['country']) |
Error Handling
The library throws errors in the following cases:
- Missing API key during initialization
- Network errors
- API request timeouts
- API error responses
All versions of gnews-io-php with dependencies
PHP Build Version
Package Version
The package gnews-io/gnews-io-php contains the following files
Loading the files please wait ...