Skip to content

lkloon123/easystore-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easystore Api

Latest Stable Version Build Status StyleCI License Total Downloads

A simple php wrapper for Easystore Api

Installation

composer require neoson/easystore-api

Usage

Setup Options

\EasyStore\Options::setOptions([
    'shop' => 'YOUR SHOP NAME', // required option
    'access_token' => 'YOUR ACCESS TOKEN', // required option for protected endpoint
    'version' => '1.0', // default value
    'timeout' => 15, // default value
]);

Create a \EasyStore\Client object

$client = new \EasyStore\Client();

Client Method

Get

$client->get($endpoint, $parameter = [])

Post

$client->post($endpoint, $body)

Put

$client->put($endpoint, $body)

Delete

$client->delete($endpoint, $body = [])

Arguments

Params Type Description
endpoint string Easystore API endpoint, refer Easytore Docs
body array body will be converted to JSON
parameter array parameter will be converted to query string

Access Token

Create an OAuth Request

// setup required options
\EasyStore\Options::setOptions([
    'shop' => 'YOUR SHOP NAME', 
    'client_id' => 'YOUR CLIENT ID',
    'scopes' => 'YOUR SCOPES', 
    'redirect_uri' => 'YOUR REDIRECT URL', 
]);

$requestUrl = $client->buildAuthUrl();

// if you are using laravel
return response()->redirect($requestUrl);

Exchange for permanent access token after oauth completed

// setup required options
\EasyStore\Options::setOptions([
    'shop' => 'YOUR SHOP NAME', 
    'client_id' => 'YOUR CLIENT ID',
    'client_secret' => 'YOUR CLIENT SECRET',
]);

$accessToken = $client->getAccessToken();
//store this access token somewhere

Contributing

If you want to contribute to a project and make it better, your help is very welcome. Just send a pr and you are all set.

License

This library is released under the MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages