Skip to content

Simple CakePHP API endpoints plugin for simplicity in connecting to API endpoints

Notifications You must be signed in to change notification settings

bmilesp/Endpoints

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Endpoints

Simple CakePHP API endpoints plugin for simplicity in connecting to API endpoints

Requirements

CakePHP => 2.1

Installation

[Using Composer]

View on Packagist, and copy the json snippet for the latest version into your project's composer.json. Eg, v. 2.1.x-dev would look like this:

{
	"require": {
		"bmilesp/endpoints": "2.1.x-dev"
	}
}

Enable plugin

Add following lines in yout app/Config/bootstrap.php file

Create a database config variable that uses the Endpoints.ApiSource datasource, and the API domain as the host:
	
	public $website_source = array(
    	'datasource' => 'Endpoints.ApiSource',
    	'host' => 'website.com'
    );
Then setup the model by using the behavior and datasource we've just setup:
	
	public $uses = array('website_source');
	public $actsAs = array('Endpoints.Endpint');

Usage

To send and retrieve data from an endpoint. here is an example:
	function unlock($slug = null){
		$postData = array('id' => 23);
		$result = $this->callEndpoint('/users/get_user_by_id',$postData);
		return $result->body; 	
	}

About

Simple CakePHP API endpoints plugin for simplicity in connecting to API endpoints

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages