承接 sonu179208/shopify-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-07