gunharth/laravel-lightspeed-api

Laravel 对 Lightspeed Seoshop API 的封装

1.0.4 2017-05-11 15:36 UTC

This package is not auto-updated.

Last update: 2024-09-28 20:09:13 UTC


README

Latest Version on Packagist Software License StyleCI

此包使与 Lightspeed eCom API 的交互变得简单。安装后,您可以像这样执行所有 API 调用

use ShopApi;

// shop info
$shopInfo = ShopApi::shop()->get();

// retrieve all products
$products = ShopApi::products()->get(); // Note: by default the API spits out 50 items with a max of 250

// with params
$products = ShopApi::products()->get(null, array('page' => 1, 'limit' => 100));

// product info with id
$productInfo = ShopApi::products()->get(1);

// to change the API language
ShopApi::setApiLanguage('de');

请参阅 Lightspeed eCom API 文档 以获取所有 API 选项的详细信息。

安装

使用 composer 安装此包

composer require gunharth/laravel-lightspeed-api

接下来,需要注册服务提供者

'providers' => [
    ...
    Gunharth\Lightspeed\LightspeedServiceProvider::class,
];

注册 Gunharth\Lightspeed\LightspeedFacade 门面

'aliases' => [
	...
    'ShopApi' => Gunharth\Lightspeed\LightspeedFacade::class,
    ...
]

使用此命令发布配置

php artisan vendor:publish --provider="Gunharth\Lightspeed\LightspeedServiceProvider"

这将发布一个名为 lightspeed-api.php 的文件到您的配置目录,并包含以下内容

<?php

return [

    /*
     * Lightspeed cluser_id
     */
    'cluster_id' => '',

     /*
     * Lightspeed API key
     */
    'api_key' => '',

    /*
     * Lightspeed API secret
     */
    'api_secret' => '',

    /*
     * Lightspeed Default API Language
     */
    'locale' => '',

];

请阅读 Lightspeed eCom API 文档 以了解如何设置正确的值和 API 密钥。

贡献

有关详细信息,请参阅 CONTRIBUTING

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件