承接 tourze/youzan-api-bundle 相关项目开发

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

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

tourze/youzan-api-bundle

Composer 安装命令:

composer require tourze/youzan-api-bundle

包简介

有赞API集成Bundle

README 文档

README

English | 中文

[Latest Version] (https://packagist.org/packages/tourze/youzan-api-bundle) [Total Downloads] (https://packagist.org/packages/tourze/youzan-api-bundle) [PHP Version Require] (https://packagist.org/packages/tourze/youzan-api-bundle) [License] (https://packagist.org/packages/tourze/youzan-api-bundle)

A Symfony bundle for integrating with Youzan API, providing account and shop management capabilities.

Table of Contents

Features

  • Account management for Youzan API credentials
  • Shop management with multi-account support
  • Client service for easy API access
  • EasyAdmin integration for backend management
  • Doctrine ORM integration with Snowflake ID support

Requirements

  • PHP 8.1 or higher
  • Symfony 6.4 or higher
  • Doctrine ORM 3.0 or higher
  • youzanyun/open-sdk 2.0 or higher
  • EasyAdmin Bundle 4.0 or higher

Installation

composer require tourze/youzan-api-bundle

Quick Start

  1. Add the bundle to your bundles.php:
<?php

return [
    // ...
    YouzanApiBundle\YouzanApiBundle::class => ['all' => true],
];
  1. Create and manage Youzan accounts:
<?php

use YouzanApiBundle\Service\YouzanClientService;

// Inject the service
public function __construct(
    private readonly YouzanClientService $youzanClientService
) {
}

// Create a new account
$account = $this->youzanClientService->createAccount(
    'Account Name',
    'your_client_id',
    'your_client_secret'
);

// Get API client
$client = $this->youzanClientService->getClient($account);

// Or get client by client ID
$client = $this->youzanClientService->getClientByClientId('your_client_id');
  1. Use the client to call Youzan API:
<?php

// Use the client to make API calls
$response = $client->get('/youzan.shop.get', ['version' => '3.0.0']);

Configuration

The bundle registers services automatically. For production use, configure your environment variables:

# .env
YOUZAN_CLIENT_ID=your_client_id
YOUZAN_CLIENT_SECRET=your_client_secret

Entities

Account

  • Manages Youzan API credentials (Client ID, Client Secret)
  • Supports multiple shops per account

Shop

  • Represents Youzan shops with KDT ID
  • Can be associated with multiple accounts

Admin Interface

The bundle provides EasyAdmin controllers for managing accounts and shops:

  • Account management: Create, edit, and delete API accounts
  • Shop management: Manage shop information and associations

Advanced Usage

For more advanced scenarios, you can extend the entities or create custom services:

<?php

use YouzanApiBundle\Entity\Account;
use YouzanApiBundle\Entity\Shop;

// Custom account with additional properties
class ExtendedAccount extends Account
{
    private string $description;
    
    // Additional methods...
}

// Custom shop repository
class CustomShopRepository extends ShopRepository
{
    public function findActiveShops(): array
    {
        return $this->createQueryBuilder('s')
            ->where('s.active = :active')
            ->setParameter('active', true)
            ->getQuery()
            ->getResult();
    }
}

Security

Reporting Security Issues

If you discover a security vulnerability, please send an email to security@tourze.com. All security vulnerabilities will be promptly addressed.

Security Best Practices

  • Store API credentials securely using environment variables
  • Use HTTPS for all API communications
  • Regularly rotate API credentials
  • Implement proper access controls for admin interfaces

Performance Tips

  • Cache API responses when possible to reduce API calls
  • Use batch operations for multiple API requests
  • Implement connection pooling for high-volume scenarios
  • Monitor API rate limits and implement backoff strategies

Changelog

Version 1.0.0

  • Initial release with basic account and shop management
  • EasyAdmin integration for backend management
  • Youzan API client service with automatic token handling

Contributing

We welcome contributions! Here's how you can help:

  1. Report Issues: Use GitHub Issues to report bugs or request features
  2. Submit Pull Requests: Fork the repository and submit PRs for improvements
  3. Code Style: Follow PSR-12 coding standards
  4. Testing: Ensure all tests pass before submitting PRs

Development Setup

# Clone the repository
git clone https://github.com/yourorg/php-monorepo.git

# Install dependencies
composer install

# Run tests
./vendor/bin/phpunit packages/youzan-api-bundle/tests

# Run code analysis
./vendor/bin/phpstan analyse packages/youzan-api-bundle

License

The MIT License (MIT). Please see License File for more information.

tourze/youzan-api-bundle 适用场景与选型建议

tourze/youzan-api-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 174 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tourze/youzan-api-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tourze/youzan-api-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 tourze/youzan-api-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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