sonu179208/shopify-sdk
最新稳定版本:v1.0.0
Composer 安装命令:
composer require sonu179208/shopify-sdk
包简介
Framework-agnostic PHP SDK for Shopify REST & GraphQL APIs
README 文档
README
# Shopify SDK for PHP A lightweight, framework-agnostic PHP SDK for interacting with the Shopify REST and GraphQL APIs. Easily integrate Shopify into any PHP app — Laravel, CodeIgniter, or Core PHP. --- ## 🛠️ Installation Install via Composer: ```bash composer require sonu179208/shopify-sdk
🚀 Quick Start
require 'vendor/autoload.php'; use ShopifySDK\Shopify; $shopify = new Shopify("yourstore.myshopify.com", "your-access-token"); // Get all products $response = $shopify->get("products.json"); print_r($response);
🧩 REST API Usage (CRUD)
✅ Create Product
$newProduct = [ "product" => [ "title" => "New Product", "body_html" => "<strong>Awesome product</strong>", "vendor" => "Sonu Inc.", "product_type" => "Custom" ] ]; $response = $shopify->post("products.json", $newProduct);
🔍 Read Products
$response = $shopify->get("products.json");
✏️ Update Product
$productId = 1234567890; $update = [ "product" => [ "id" => $productId, "title" => "Updated Product Title" ] ]; $response = $shopify->put("products/{$productId}.json", $update);
❌ Delete Product
$productId = 1234567890; $response = $shopify->delete("products/{$productId}.json");
⚡ GraphQL API Usage
✅ Run a GraphQL Query
$query = <<<GQL { shop { name myshopifyDomain } } GQL; $response = $shopify->graphql($query);
🧪 Create Product via GraphQL (Mutation)
$mutation = <<<GQL mutation { productCreate(input: { title: "GraphQL Product", bodyHtml: "Product via GraphQL" }) { product { id title } userErrors { field message } } } GQL; $response = $shopify->graphql($mutation);
🔔 Webhook Management
Create Webhook
$response = $shopify->registerWebhook("orders/create", "[https://yourdomain.com/webhooks/order-created](https://yourdomain.com/webhooks/order-created)");
List Webhooks
$response = $shopify->listWebhooks();
Delete Webhook
$webhookId = 123456789; $response = $shopify->deleteWebhook($webhookId);
🧱 Framework Compatibility
- ✅ Laravel
- ✅ CodeIgniter
- ✅ Symfony
- ✅ Core PHP
- ✅ Any modern PHP app (PHP 7.4+)
👨💻 Author
Sonu Kumar
- GitHub: @sonu179208
- Email: sonu179208@gmail.com
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-07