Skip to content

Lightweight multi-paradigm PHP (JSON) client for the new Basecamp API. Inspired by, and largely cribbed from, shopify.php by @sandeepshetty

License

Notifications You must be signed in to change notification settings

bdunlap/basecamp.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

shopify.php

Lightweight PHP (JSON) client for the Shopify API.

Getting Started

Download

Download the latest version of shopify.php:

$ curl -L http://github.com/sandeepshetty/shopify.php/tarball/master | tar xvz
$ mv shopify.php-shopify.php-* shopify.php

Configure

Open up the shopify.php file and edit the values of the constants SHOPIFY_APP_API_KEY and SHOPIFY_APP_SHARED_SECRET to your app's API Key and Shared Secret respectively.

Require

<?php
	require 'path/to/shopify.php/shopify.php';
?>

Usage

Creating the app installation URL:

<?php

	$url = shopify_app_install_url($shop_domain);

?>

Validate the installation when Shopify redirects the shop owner to your app's Return URL after installation:

<?php

	if (!shopify_validate_app_installation($_GET['shop'], $_GET['t'], $_GET['timestamp'], $_GET['signature']))
	{
		// Guard Clause
	}

?>

Making API calls:

<?php

	$shopify = shopify_api_client($shops_myshopify_domain, $shops_token);
	$response = $shopify('GET', '/admin/products/count.json', array('published_status'=>'published'));

?>

Response

The response array looks like this:

<?php

	array
	(
		'error'=> false, // Indicates CURL errors.
		'body'=> array(), // The Shopify API response as an associative array
		'status_message' => 'Created', // HTTP status message
		'status_code' => '201', // HTTP status code
		'headers' => array() // HTTP headers as an associative array with lowercase keys
	);

?>

About

Lightweight multi-paradigm PHP (JSON) client for the new Basecamp API. Inspired by, and largely cribbed from, shopify.php by @sandeepshetty

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%