magentix/unopim-php-api-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

magentix/unopim-php-api-client

最新稳定版本:1.0.4

Composer 安装命令:

composer require magentix/unopim-php-api-client

包简介

Simple PHP UnoPim API Client

README 文档

README

Installation

composer require magentix/unopim-php-api-client

Usage

$apiUrl = 'https://www.example.com';
$clientId = '1a1b1c1d-2e2f-3g3h-4i4j-5k5l5m5n5o5p';
$clientSecret = '1a3b5c7d9e2f4g6h8i1j3k5l7m9n2o4p6q8r1s3t';
$username = 'john.doe@example.com';
$password = 'Password';

$cache = new \Magentix\UnoPimApiClient\UnoPimApiCache(
    __DIR__ . DIRECTORY_SEPARATOR . 'api_cache', // The cache file directory path
    86400 // Request lifetime in seconds (GET requests in HTTP 200 are cached, 0 to disable)
);

$client = new \Magentix\UnoPimApiClient\UnoPimApiClient(
    $apiUrl,
    $clientId,
    $clientSecret,
    $username,
    $password,
    $cache,
    3000 // Authentication lifetime (need to be lower that the access token TTL, 0 to disable)
);

GET

$result = $client->get('/api/v1/rest/categories');
$params = [
    'filters' => [
        'categories' => [
            [
                'operator' => 'IN',
                'value' => ['beers']
            ]
        ]
    ],
    'limit' => 10,
];
$result = $client->get('/api/v1/rest/products', $params);

POST

$data = [
    'code' => 'beers',
    'parent' => 'root',
    'additional_data' => [
        'locale_specific' => [
            'en_US' => ['name' => 'Beers'],
            'fr_FR' => ['name' => 'Bières'],
        ]
    ]
];
$result = $client->post('/api/v1/rest/categories', $data);

PUT

$data = [
    'parent' => 'root',
    'additional_data' => [
        'locale_specific' => [
            'en_US' => ['name' => 'Beers'],
            'fr_FR' => ['name' => 'Bières'],
        ]
    ]
];
$result = $client->put('/api/v1/rest/categories/beers', $data);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-02-17