Skip to content

Added functions to link to the News API servers.#1

Open
phillytan wants to merge 5 commits intoNews-API-gh:masterfrom
phillytan:master
Open

Added functions to link to the News API servers.#1
phillytan wants to merge 5 commits intoNews-API-gh:masterfrom
phillytan:master

Conversation

@phillytan
Copy link

@phillytan phillytan commented Dec 14, 2017

The library offers three main functions to get the data. These are getSources, getTopHeadlines, and getEverything. Users may either use method chaining or placing an array into the respective functions in order to send data to the requests.

Example:

These two examples return the same data. They're just different available methods in placing the data.

<?php
include 'vendor/autoload.php';
$newsapi = new NewsAPI\NewsAPI('your_api_key_here');
$request = $newsapi->category('technology')->language('en')->getTopHeadlines();
var_dump($request);
<?php
include 'vendor/autoload.php';
$newsapi = new NewsAPI\NewsAPI('your_api_key_here');
$request = $newsapi->getTopHeadlines([
'category' => 'technology',
'language' => 'en'
]);
var_dump($request);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant