newsorg/commercial

News API Commercial PHP Library.

dev-master 2019-09-16 09:06 UTC

README

By Goodwish Matyila Support: 084 790-8653

Installation

 
composer require newsorg/commercial

This package is not auto-updated. Please set up the GitHub Service Hook for Packagist so that it gets updated whenever you push!
News API Commercial PHP Library.

Requirements

cUrl Extensions

PHP >= 7.0

#Require the class

require_once 'News.php';

Include namespace

use News\Resources as Articles;

Extend base class

class Latest extends Articles{
	public function __construct(){
		parent::__construct();
	}
}

Usage, Get Everything

 $queryOptionsEverything = Array(
	"apiKey"=>"your-api-key", 
	"from" => "2008-03-02",
	"to"=>"2018-08-05",
	"query" => "news-south-africa",
	"language" => "en"
	);

Pass the options to setEverything with argument

 Latest::setEverything($queryOptionsEverything);
 

Usage, Get sources

 $queryOptionsSources = Array(
	"apiKey"=>"your-api-key", 
	"from" => "2008-03-02",
	"to"=>"2008-03-05",
	"query" => "soccer",
	"country" => "za",
	"language" => "en"
	);

Pass the options to setSources with argument

 Latest::setSources($queryOptionsSources);
 

Usage, Get Headlines

 $queryOptionsHeadlines = Array(
	"apiKey"=>"your-api-key", 
	"from" => "2008-03-02",
	"to"=>"2008-03-05",
	"query" => "soccer",
	"country" => "za",
	"language" => "en"
	);
 

Pass the options to setHeadlines with argument

 Latest::setHeadlines($queryOptionsHeadlines);