PHP code example of waynestate / news-api-php

1. Go to this page and download the library: Download waynestate/news-api-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

waynestate / news-api-php example snippets



use Waynestate\Api\News;

// News API
$news = new News(NEWS_API_KEY);

// List of releases
$releases = $news->request('releases', array('perPage' => '2'));
var_dump($releases);

// Individual Release
$release = $news->request('releases', array('id' => '1'));
var_dump($release);