timothydc/laravel-lightspeed-ecom-api

Connect with the Lightspeed eCom API

v1.6.0 2024-04-04 14:53 UTC

This package is auto-updated.

Last update: 2024-11-04 16:12:08 UTC


README

Latest Version on Packagist Total Downloads Github Tests Action Tests Github Tests Action Styling

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

Via Composer:

composer require timothydc/laravel-lightspeed-ecom-api

Configuration

You can publish the config file with:

php artisan vendor:publish --tag=lightspeed-ecom-api:config 

Usage

Interaction works the same as the Lightspeed API.

Authentication

// change API language
LightspeedEcomApi::setLanguage('en');

// change API key and secret
LightspeedEcomApi::setCredentials('key', 'secret');

Rate limits

By default, each API key caches its remaining calls and next reset time. If you would like to disable this behavior, deactive this feature by setting save_remaining_calls_to_cache to false in config/lightspeed-ecom-api.php.

// get max calls for your API keys
LightspeedEcomApi::getMaxCalls();

// get Carbon with next reset time - from the cache
LightspeedEcomApi::getResetTime();

// get Carbon with next reset time - from the last API response header
LightspeedEcomApi::getResetTime(false);

// get available API limits - from the cache
LightspeedEcomApi::getRemainingCalls();

// get available API limits - from the last API response header
LightspeedEcomApi::getRemainingCalls(false);

Calling resources

// get products
LightspeedEcomApi::products()->get();

// get single product
LightspeedEcomApi::products()->get(123456789);

// get filtered products
LightspeedEcomApi::products()->get(null, ['limit' => 250, 'page' => 1, 'since_id' => 123]);

// create product
LightspeedEcomApi::products()->create(['title' => 'my product']);

// update product
LightspeedEcomApi::products()->update(123456789, ['title' => 'my other product']);

Testing

composer test

Security

If you discover any security related issues, please email mail@timothydc.be instead of using the issue tracker.

Credits

License

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