bannerstop/helix-sdk
Composer 安装命令:
composer require bannerstop/helix-sdk
包简介
Helix SDK for PHP
README 文档
README
Features
- Authentication: Easy token-based session management using
CredentialsTokenProvider. - Order Conversion: Support for various ecommerce formats:
- Mention (Order & Item structure)
- Magento (Order & Product structure)
- Generic Converter: Flexible data mapping with
GenericRequestDto. - Type Safety: Uses modern PHP features and DTOs to ensure data integrity.
- Error Handling: Custom exceptions for authentication and API failures.
Installation
Install the SDK via Composer:
composer require bannerstop/helix-sdk
Ensure your environment meets the minimum requirements:
- PHP 7.4 or higher
ext-jsonextension- Symfony HTTP Client & Serializer components
Quick Start
1. Simple Authentication
The SDK provides a standard CredentialsTokenProvider which handles automatic token retrieval from your login credentials.
use Helix\Sdk\Auth\CredentialsTokenProvider; use Symfony\Component\HttpClient\HttpClient; $httpClient = HttpClient::create(); $baseUrl = 'https://api.helix-converter.com'; $tokenProvider = new CredentialsTokenProvider( $httpClient, $baseUrl, 'your-username', 'your-password' );
2. Using the Helix Client
Instantiate the main client with the token provider.
use Helix\Sdk\Client\HelixClient; $client = new HelixClient($httpClient, $tokenProvider, $baseUrl);
3. Example: Convert a Magento Order
use Helix\Sdk\Dto\Request\MagentoOrderDto; use Helix\Sdk\Dto\Request\MagentoProductDto; use Helix\Sdk\Dto\Request\ProductOptionDto; $items = [ new MagentoProductDto('SKU-123', 'My Product', [ new ProductOptionDto('Size', 'XL'), new ProductOptionDto('Color', 'Blue') ]) ]; $order = new MagentoOrderDto($items); try { $response = $client->convertMagentoOrder($order); if ($response->converted !== null) { foreach ($response->converted->items as $item) { // Processing results (e.g., converted product data) echo "Converted Product: " . $item->name . " (SKU: " . $item->sku . ")\n"; } } } catch (\Helix\Sdk\Exception\HelixApiException $e) { echo "API Error: " . $e->getMessage(); }
Available Operations
Specific Converters
| Method | Request Object | Description |
|---|---|---|
convertMentionOrder |
MentionOrderDto |
Converts items from the Mention platform format. |
convertMagentoOrder |
MagentoOrderDto |
Converts orders from Magento format. |
convertMagentoProduct |
MagentoProductDto[] |
Batch conversion of Magento product data. |
genericConvert |
GenericRequestDto |
Universal endpoint for custom conversion logic. |
Error Handling
The SDK throws descriptive exceptions:
Helix\Sdk\Exception\AuthenticationException: Thrown when login fails or credentials are invalid.Helix\Sdk\Exception\HelixApiException: Thrown when an API request fails or returns an error status code.
Development and Architecture
This project strictly follows the PSR-4 standard and is based on a clean, decoupled architecture:
- Auth: Contracts and implementations for token management.
- Client: The public interface for interacting with the Helix API.
- Dto: Data Transfer Objects for strongly typed request/response interaction.
- Exception: Specialized exception hierarchy.
License
This library is released under the MIT License. See LICENSE for details.
bannerstop/helix-sdk 适用场景与选型建议
bannerstop/helix-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bannerstop/helix-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bannerstop/helix-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-01