timothydc / laravel-lightspeed-ecom-product-feeds
Laravel package for Lightspeed product feeds
Requires
- php: ^7.4|^8.0
- illuminate/support: ^7.0|^8.0|^9.0
- laravel/legacy-factories: ^1.0.5
- spatie/array-to-xml: ^2.10
- timothydc/laravel-lightspeed-ecom-api: ^1.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- orchestra/testbench: ^5.0|^6.0
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-04-25 17:16:33 UTC
README
Installation
Via Composer
$ composer require timothydc/laravel-lightspeed-ecom-product-feeds
You can publish all resources, or you may choose to publish them separately:
$ php artisan vendor:publish --tag="lightspeed-ecom-product-feed" $ php artisan vendor:publish --tag="lightspeed-ecom-product-feed:config" $ php artisan vendor:publish --tag="lightspeed-ecom-product-feed:migrations"
Run your migrations to create the product_feeds
table.
$ php artisan migrate
You can choose to automatically run the created feeds via the task scheduler.
It is also possible to generate the feeds directly or via a queue job. See config/lightspeed-ecom-product-feed.php
for more configuration options.
return [ 'feed_disk' => env('LS_PRODUCT_FEEDS_FEED_DISK', 'public'), 'scheduled_tasks' => [ 'auto_run' => env('LS_PRODUCT_FEEDS_AUTO_RUN', true), 'use_queue' => env('LS_PRODUCT_FEEDS_USE_QUEUE', true), 'queue' => env('LS_PRODUCT_FEEDS_QUEUE', 'default') ], ];
Custom feed mapping
Create your own class and let it implement ProductPayloadMappingInterface
. Or take a look at TimothyDC\LightspeedEcomProductFeed\Feeds\StandardFeed
for some XML data structure inspiration.
use TimothyDC\LightspeedEcomProductFeed\Interfaces\ProductPayloadMappingInterface; class CustomProductXml implements ProductPayloadMappingInterface { public function execute(string $baseUrl, array $product): array { return ['product_id' => $product['id']]; } }
This package also offers some template feeds for:
- Sooqr (
TimothyDC\LightspeedEcomProductFeed\Feeds\SooqrFeed
)
Available commands
Create a new product feed and answer the presented questions. Enter a valid cron expression when asked. Use a FQN for your custom class.
$ php artisan ecom-feed:create > Enter your custom mapping class: > Enter your cron interval: > Enter your webshop API key: > Enter your webshop API secret: > What language should your feed be in?
Show a list of all the currently created product feeds.
$ php artisan ecom-feed:list
Update a product feed.
$ php artisan ecom-feed:update {id}
Show a product feed configuration.
$ php artisan ecom-feed:show {id}
Remove a product feed.
$ php artisan ecom-feed:remove {id}
Generate an XML by providing a product feed ID.
$ php artisan ecom-feed:generate {id}
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Credits
License
MIT. Please see the license file for more information.