承接 mannu24/google-merchant-center 相关项目开发

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

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

mannu24/google-merchant-center

Composer 安装命令:

composer require mannu24/google-merchant-center

包简介

A comprehensive Laravel package for Google Merchant Center integration with product synchronization, batch processing, and automatic sync management.

README 文档

README

A comprehensive Laravel package for seamless Google Merchant Center product synchronization with independent tables, batch processing, and automatic sync management.

Features

  • 🚀 Product Synchronization - Sync products with Google Merchant Center
  • 📦 Batch Processing - Handle large datasets efficiently
  • 🔄 Automatic Sync - Set up automated synchronization workflows
  • 🎯 Per-Product Control - Enable/disable sync for individual products
  • 📊 Sync Logging - Comprehensive tracking and monitoring
  • 🛡️ Error Handling - Robust retry logic and error management
  • Performance Optimized - Rate limiting and caching
  • 🔧 Laravel Integration - Seamless Laravel ecosystem integration

Requirements

  • PHP 8.0 or higher
  • Laravel 8.x, 9.x, 10.x, 11.x, or 12.x
  • Google Merchant Center account
  • Google API credentials

Installation

composer require mannu24/google-merchant-center

Quick Setup

  1. Publish configuration:
php artisan vendor:publish --tag=gmc-config
  1. Publish migrations:
php artisan vendor:publish --tag=gmc-migrations
  1. Run migrations:
php artisan migrate
  1. Configure environment variables:
GMC_MERCHANT_ID=your_merchant_id
GMC_SERVICE_ACCOUNT_JSON=/path/to/service-account.json
GMC_AUTO_SYNC=true
GMC_BATCH_SIZE=50
GMC_RETRY_ATTEMPTS=3

Basic Usage

1. Add Trait to Your Product Model

use Mannu24\GoogleMerchantCenter\Traits\SyncsWithGMC;

class Product extends Model
{
    use SyncsWithGMC;
    
    protected $fillable = [
        'title', 'description', 'price', 'quantity', 
        'image_url', 'brand', 'sku', 'status'
    ];
    
    public function prepareGMCData(): array
    {
        return [
            'offerId' => $this->sku ?: (string) $this->id,
            'title' => $this->title,
            'description' => $this->description,
            'link' => url("/products/{$this->id}"),
            'imageLink' => $this->image_url,
            'price' => ['value' => (string) $this->price, 'currency' => 'USD'],
            'availability' => $this->quantity > 0 ? 'in stock' : 'out of stock',
            'brand' => $this->brand,
            'condition' => 'new'
        ];
    }
}

2. Sync Products

// Manual sync
$product->syncToGMC();

// Force sync (ignores cache)
$product->forceSyncToGMC();

// Check sync status
if ($product->isSyncedWithGMC()) {
    echo "Product is synced!";
}

3. Bulk Operations

use Mannu24\GoogleMerchantCenter\Services\GMCService;

$gmcService = app(GMCService::class);
$result = $gmcService->syncMultipleProducts($products, 25);

4. Artisan Commands

# Sync all products
php artisan gmc:sync-all

# Sync with filters
php artisan gmc:sync-all --filter="status=active"

# Dry run (no actual sync)
php artisan gmc:sync-all --dry-run

# Force sync (ignore cache)
php artisan gmc:sync-all --force

Database Structure

gmc_products Table

  • product_id - Reference to your product
  • product_type - Model class name
  • sync_enabled - Control sync per product
  • gmc_product_id - GMC's product ID
  • gmc_last_sync - Last sync timestamp
  • sync_status - Current sync status
  • last_error - Last error message

gmc_sync_logs Table

  • Tracks all sync attempts
  • Stores request/response data
  • Performance metrics
  • Error details

Advanced Features

Batch Processing

$gmcService = app(GMCService::class);
$gmcService->setBatchSize(25);
$result = $gmcService->syncMultipleProducts($products);

Error Handling

try {
    $product->syncToGMC();
} catch (\Exception $e) {
    Log::error('GMC Sync failed: ' . $e->getMessage());
}

Sync History

use Mannu24\GoogleMerchantCenter\Models\GMCSyncLog;

$logs = GMCSyncLog::with('gmcProduct')->latest()->get();
$failedLogs = GMCSyncLog::where('status', 'failed')->get();

Configuration

The package configuration file (config/gmc.php) includes:

  • API credentials and endpoints
  • Batch processing settings
  • Retry and timeout configurations
  • Logging preferences
  • Cache settings

Testing

composer test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This package is open-sourced software licensed under the MIT license.

Support

mannu24/google-merchant-center 适用场景与选型建议

mannu24/google-merchant-center 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 08 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「ecommerce」 「laravel」 「laravel-package」 「google-shopping」 「google-merchant-center」 「gmc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 mannu24/google-merchant-center 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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