2017 © Pedro Peláez
 

library shopify_api

Simple Shopify API client in PHP

image

secomapp/shopify_api

Simple Shopify API client in PHP

  • Tuesday, November 7, 2017
  • by cuongnhc
  • Repository
  • 1 Watchers
  • 0 Stars
  • 54 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 84 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

shopify_api

Simple Shopify API client in PHP, (*1)

Requirements

Getting Started

Download via Composer

Create a composer.json file if you don't already have one in your projects root directory and require shopify_api:, (*2)

{
    "minimum-stability": "dev",
    "require": {
        "secomapp/shopify_api": "dev-master"
    }
}

Install Composer:, (*3)

$ curl -s http://getcomposer.org/installer | php

Run the install command:, (*4)

$ php composer.phar install

This will download shopify_api into the vendor/sandeepshetty/shopify_api directory., (*5)

To learn more about Composer visit http://getcomposer.org/, (*6)

Require and use


Usage

Generating the app's installation URL for a given store:


Verify the origin of all requests/redirects from Shopify:


Generating the oAuth2 permission URL:


Get the permanent oAuth2 access token:


Making API calls:

'published'));


        // Create a new recurring charge
        $charge = array
        (
            "recurring_application_charge"=>array
            (
                "price"=>10.0,
                "name"=>"Super Duper Plan",
                "return_url"=>"http://super-duper.shopifyapps.com",
                "test"=>true
            )
        );

        try
        {
            // All requests accept an optional fourth parameter, that is populated with the response headers.
            $recurring_application_charge = $shopify('POST', '/admin/recurring_application_charges.json', $charge, $response_headers);

            // API call limit helpers
            echo shopify_api\calls_made($response_headers); // 2
            echo shopify_api\calls_left($response_headers); // 298
            echo shopify_api\call_limit($response_headers); // 300

        }
        catch (shopify_api\Exception $e)
        {
            // If you're here, either HTTP status code was >= 400 or response contained the key 'errors'
        }

    }
    catch (shopify_api\Exception $e)
    {
        /* $e->getInfo() will return an array with keys:
            * method
            * path
            * params (third parameter passed to $shopify)
            * response_headers
            * response
            * shops_myshopify_domain
            * shops_token
        */
    }
    catch (shopify_api\CurlException $e)
    {
        // $e->getMessage() returns value of curl_error() and $e->getCode() returns value of curl_errno()
    }
?>

The Versions

07/11 2017

dev-master

9999999-dev https://github.com/secomapp/shopify_api

Simple Shopify API client in PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar cuongnhc
by Will Shahda

api shopify