seisigmasrl / lemonsqueezy-php
Lemon Squeezy API PHP 客户端
1.3.0
2023-05-03 06:03 UTC
Requires
- php: ^8.2
- ext-json: *
- nyholm/psr7: ^1.5
- php-http/client-common: ^2.6
- php-http/discovery: ^1.15
- php-http/httplug: ^2.3
- psr/http-client-implementation: *
- psr/http-factory-implementation: *
- psr/http-message: ^1.0
- symfony/http-client: ^6.2
- symfony/polyfill-php82: ^1.27
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
- pestphp/pest: ^2.0
- spatie/ray: ^1.28
This package is auto-updated.
Last update: 2024-09-26 22:24:46 UTC
README
我喜欢来自创新的竞争。对于全球的企业和创作者来说,能够对服务收费是这个全球世界中最需要的需求之一。遗憾的是,很少有公司能提供这种解决方案。Lemon Squeeze 通过成为您的账单商,处理税务合规负担,让您可以专注于更多的收入和更少的问题。
此 SDK 包装了 Lemon Squeezy API,以简化 PHP 语言的集成。
我开始这个项目是出于个人和职业的动机。所以我将所有努力都投入到尽快完成待办事项清单中。为了开始推广这个包,我从第一天开始就开放它,并将每个新端点作为新功能发布。第一个版本包括包核心和用户端点信息。
安装
此包需要 PHP 8.2。要开始,使用如下方式使用 Composer 安装
composer require seisigmasrl/lemonsqueezy-php
此 SDK 架构高度受 DigitalOcean Client 包的启发,通过使用 PSR-7、PSR-17、PSR-18 和 HTTPlug 与任何 HTTP 消息客户端解耦。您可以访问 HTTPlug 以获取有关安装 HTTPlug 相关包的更多信息。此包将自动发现您可用的 HTTP 客户端。
用法
我将创建一个包含 SDK 最终文档的官方网站,但在此期间,以下是当前选项的详细信息
# Initializing the Package <?php require_once 'vendor/autoload.php'; // Create a new LemonSqueezy client $client = new \LemonSqueezy\LemonSqueezy(); // Authenticate the client by providing your API Token which can be // generated at https://app.lemonsqueezy.com/settings/api $client->authenticate('yourApiToken');
以下是此包基于现有端点提供的方法列表
用户
<?php # Initialize the Package from the step before ... // Get the user information base on the defined in the Lemon Squeeze API Documentation // https://docs.lemonsqueezy.com/api/users#the-user-object $user = $client->user(); $userDetails = $user->getUserInformation(); var_dump($userDetails); // object(LemonSqueezy\Entity\User)#4567 (7) { // ["id"]=> id(5) "13546" // New // ["name"]=> string(14) "Marco Polo" // ["email"]=> string(19) "marco@polo.com" // ["color"]=> string(7) "#7047EB" // ["avatar_url"]=> string(72) "https://www.gravatar.com/avatar/cc27e9f9e9a66d0fb6a988a?d=blank" // ["has_custom_avatar"]=> bool(false) // ["createdAt"]=> string(27) "2023-01-18T13:56:46.000000Z" // ["updatedAt"]=> string(27) "2023-01-18T14:00:01.000000Z" // } // Get only the ID of the User // $userId = $user->getUserId(); Deprecated.
商店
<?php # Initialize the Package from the step before ... // Get the user information base on the defined in the Lemon Squeeze API Documentation // https://docs.lemonsqueezy.com/api/stores#the-store-object $lemonSqueeze = $client->store(); $storeList = $lemonSqueeze->getAllStores(); // List all existing Stores $store = $lemonSqueeze->getStore(12685); // Get details of the store with the ID: 12685
客户
<?php # Initialize the Package from the step before ... // Get the user information base on the defined in the Lemon Squeeze API Documentation // https://docs.lemonsqueezy.com/api/customers#the-customer-object $lemonSqueeze = $client->customer(); $allCustomers = $lemonSqueeze->getAllCustomers(); // List all existing Customers $storeCustomers = $lemonSqueeze->getStoreCustomers(12689); // List all customers from the Store ID: 12689 $customer = $lemonSqueeze->getCustomer(596510); // Get the details of the Customer with the ID: 596510
产品
<?php # Initialize the Package from the step before ... // Get the user information base on the defined in the Lemon Squeeze API Documentation // https://docs.lemonsqueezy.com/api/products#the-product-object $lemonSqueeze = $client->product(); $allProducts = $lemonSqueeze->getAllProducts(); // List all existing Products $storeCustomers = $lemonSqueeze->getStoreProducts(12689); // List all Products from the Store ID: 12689 $product = $lemonSqueeze->getProduct(59920); // Get the details of the Products with the ID: 59920 $productVariants = $lemonSqueeze->getProductVariants(59920); // Get all Variants from the Product ID: 59920 $productWithVariants = $lemonSqueeze->getProductWithVariants(59920); // Get a Product with All their Variants
路线图/待办事项
- 通用
- 身份验证 - v.1.0.0
- 速率限制 - v.1.0.0
- 错误(异常)- v.1.0.0
- 分页 - 进行中
- 相关资源
- 过滤
- 身份验证 - v.1.0.0
- 用户 - v.1.0.0
- 检索已验证用户信息 - v.1.0.0
- 检索登录用户的 ID - v.1.0.0
- 商店 - v.1.2.0
- 列出所有商店 - v.1.2.0
- 检索商店 - v.1.2.0
- 客户 - v.1.2.0
- 列出所有客户 - v.1.2.0
- 列出商店中的所有客户 - v.1.2.0
- 检索客户 - v.1.2.0
- 产品 - v.1.3.0
- 列出所有产品 - v.1.3.0
- 列出商店中的所有产品 - v.1.3.0
- 检索产品 - v.1.3.0
- 列出产品的所有变体 - v.1.3.0
- 检索具有所有变体的产品 - v.1.3.0
- 文件
- 列出所有文件 - v.1.0.0
- 检索文件 - v.1.0.0
- 订单
- 列出所有订单 - v.1.0.0
- 检索订单 - v.1.0.0
- 列出所有订单项目 - v.1.0.0
- 检索订单项目 - v.1.0.0
- 订阅
- 列出所有订阅 - v.1.0.0
- 检索订阅 - v.1.0.0
- 更新订阅 - v.1.0.0
- 取消订阅 - v.1.0.0
- 列出所有订阅发票 - v.1.0.0
- 检索订阅发票 - v.1.0.0
- 折扣
- 创建折扣
- 列出所有折扣
- 检索折扣
- 删除折扣
- 列出所有折扣兑换
- 检索折扣兑换
- 结账
- 列出所有结账记录
- 检索结账记录
- 创建结账
- 许可证密钥
- 列出所有许可证密钥
- 检索许可证密钥
- 列出所有许可证密钥实例
- 检索许可证密钥实例
- Webhooks?待定
- API 文档(一个不错的文档)。