secomapp/shopify_api
Composer 安装命令:
composer require secomapp/shopify_api
包简介
Simple Shopify API client in PHP
README 文档
README
Simple Shopify API client in PHP
Requirements
- PHP 5.3 with cURL support.
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:
{
"minimum-stability": "dev",
"require": {
"secomapp/shopify_api": "dev-master"
}
}
Install Composer:
$ curl -s http://getcomposer.org/installer | php
Run the install command:
$ php composer.phar install
This will download shopify_api into the vendor/sandeepshetty/shopify_api directory.
To learn more about Composer visit http://getcomposer.org/
Require and use
<?php use secomapp\shopify_api; ?>
Usage
Generating the app's installation URL for a given store:
<?php $install_url = shopify_api\install_url($shop_domain, $api_key); ?>
Verify the origin of all requests/redirects from Shopify:
<?php if (shopify_api\is_valid_request($_GET, $shared_secret)) { ... } ?>
Generating the oAuth2 permission URL:
<?php $permission_url = shopify_api\permission_url($_GET['shop'], $api_key, array('read_products', 'read_orders')); ?>
Get the permanent oAuth2 access token:
<?php $access_token = shopify_api\oauth_access_token($_GET['shop'], $api_key, $shared_secret, $_GET['code']) ?>
Making API calls:
<?php // For regular apps: $shopify = shopify_api\client($shops_myshopify_domain, $shops_access_token, $api_key, $shared_secret); // For private apps: // $shopify = shopify_api\client($shops_myshopify_domain, NULL, $api_key, $password, true); // If your migrating from legacy auth: // $password = shopify_api\legacy_token_to_oauth_token($shops_legacy_token, $shared_secret); // $shopify = shopify_api\client($shops_myshopify_domain, $password, $api_key, $shared_secret); try { // Get all products $products = $shopify('GET', '/admin/products.json', array('published_status'=>'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() } ?>
secomapp/shopify_api 适用场景与选型建议
secomapp/shopify_api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 134 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 12 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「shopify」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 secomapp/shopify_api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 secomapp/shopify_api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 secomapp/shopify_api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Shopify package for Laravel to aide in app development
A basic Shopify API wrapper with REST and GraphQL support.
A set of APIs to retrieve data from Shopify
PHP SDK for Shopify API
A simple API wrapper for Shopify using Guzzle for REST
统计信息
- 总下载量: 134
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-02