承接 mvenghaus/saloon-magento2-connector 相关项目开发

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

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

mvenghaus/saloon-magento2-connector

最新稳定版本:2.0.2

Composer 安装命令:

composer require mvenghaus/saloon-magento2-connector

包简介

Saloon Connector for Magento 2

README 文档

README

Saloon - Magento 2 Connector with token handling, allowing you to easily start building your own requests. It is only working if 2FA is disabled.

Installation

Install the package via composer:

composer require mvenghaus/saloon-magento2-connector

Usage

Basic Structure

$configuration = new Configuration(...);
$connector = new ApiConnector($configuration);

$response = $connector->send(new Your_Request());

Configuration - Structure

class Configuration
{
    public function __construct(
        public string $endpoint, // https://www.your-domain.com/rest/V1/
        public string $username,
        public string $password,
        public int $tokenLifetime = 0, // admin defined token lifetime in seconds 
        public ?string $authenticator = null, // saloon authenticator (serialized)
        public ?Closure $authenticatorUpdateCallback = null, // callback to save authenticator if changed
        public ?Closure $debugCallback = null // callback for debugging
    ) {
    }
}

Configuration - Example

$authenticator = load_from_your_cache();

$configuration = new Configuration(
    'https://www.your-domain.com/rest/V1/',
    'USERNAME',
    'PASSWORD',
    3600,
    $authenticator,
    function (string $authenticator) {
        save_to_your_cache($authenticator);
    },
    function (PendingRequest $pendingRequest, RequestInterface $psrRequest) {
        echo $pendingRequest->getUrl() . PHP_EOL;
    }
);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-05-31