Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rohit-chouhan/theguardian-api-php
PHP API Client for The Guardian News.
https://github.com/rohit-chouhan/theguardian-api-php
api api-client free guardiannews newsapi
Last synced: about 1 month ago
JSON representation
PHP API Client for The Guardian News.
- Host: GitHub
- URL: https://github.com/rohit-chouhan/theguardian-api-php
- Owner: rohit-chouhan
- License: mit
- Created: 2022-06-15T10:11:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-15T13:10:05.000Z (over 2 years ago)
- Last Synced: 2024-05-02T05:11:58.950Z (7 months ago)
- Topics: api, api-client, free, guardiannews, newsapi
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHP API Client for The Guardian News.
**Requirements**
* PHP 5.6.0 or greaterThe documentation for the Guardian News API can found [here](http://open-platform.theguardian.com/documentation/), In order to connect you will need an api key, which you can be generate from [here](http://open-platform.theguardian.com/access/)
### Usage
To use this client api, first download this gihutb files, and start using.
```php
get_articles() | Content |
| $theguardian->get_article(`id`) | Single Item |
| $theguardian->get_tags() | Tags |
| $theguardian->get_sections() | Sections |
| $theguardian->get_editions() | Editions |#### 📌 get_articles() `Content`
A Content module can be utilized as an interface for the content endpoint provided by the Guardian.
```php
search("test")
->section("technology")
->show_fields("all")
->get_articles();
//you can add more functions to the objectforeach ($articles as $article) {
echo $article->webTitle."
";
}
?>
```
#### 📌 get_article() `Single Item`
```php
show_fields("all")
->get_article("business/2014/feb/18/uk-inflation-falls-below-bank-england-target");
?>
```
#### 📌 get_tags() `Tags`
Tags are returned by the tags endpoint. We manually categorize all Guardian content based on these tags, which number more than 50,000.
```php
search("sport")
->get_tags()
?>
```
#### 📌 get_sections() `Sections`
Using this section module, the Guardian's sections endpoint can be accessed. The guardian's data can be accessed through this link. For example, business, sports, and technology are examples of query parameters (q).
```php
search("sport")
->get_sections()
?>
```
#### 📌 get_editions() `Editions`
All editions in the API are returned by the editions endpoint. An edition is a front main page on the Guardian site. There are currently editions of the Guardian available for the United Kingdom(uk), the United States(us) and Australia(au).
```php
search("sport")
->get_editions()
?>
```#### Developer
This API Client created by [Rohit Chouhan](https://rohitchouhan.com)