justbetter / laravel-magento-products
Package to store product data in a local DB
Installs: 11 799
Dependents: 4
Suggesters: 0
Security: 0
Stars: 15
Watchers: 4
Forks: 1
Open Issues: 0
Type:package
Requires
- php: ^8.1
- justbetter/laravel-magento-client: ^2.6.1
- laravel/framework: ^10.0|^11.0
Requires (Dev)
- doctrine/dbal: ^3.7.1
- larastan/larastan: ^2.9
- laravel/pint: ^1.6
- orchestra/testbench: ^8.0|^9.0
- pestphp/pest: ^2.0
- phpstan/phpstan-mockery: ^1.1
- phpunit/phpunit: ^10.0
README
This package tracks if products exist in Magento by storing the status locally in the DB. We developed this to prevent multiple calls when multiple packages need to check product existence in Magento.
Installation
Require this package:
composer require justbetter/laravel-magento-products
Add the following to your schedule to automatically search for products in Magento.
$schedule->command(\JustBetter\MagentoProducts\Commands\CheckKnownProductsExistenceCommand::class)->twiceDaily(); $schedule->command(\JustBetter\MagentoProducts\Commands\DiscoverMagentoProductsCommand::class)->daily();
Important
This package requires Job Batching
Usage
Checking if a product exists in Magento
You can use this package to determine if products exist in Magento. For example:
$exists = app(\JustBetter\MagentoProducts\Contracts\ChecksMagentoExistence::class)->exists('sku')
If it does not exist the sku will still be stored in the database. The \JustBetter\MagentoProducts\Commands\CheckKnownProductsExistenceCommand
command will automatically check these known products for existence.
Retrieving product data
You can use this package to retrieve product data. This data will be saved in the database and automatically retrieved when it is older than X hours. You can configure the amount of ours in the config file For example:
$exists = app(\JustBetter\MagentoProducts\Contracts\RetrievesProductData::class)->retrieve('sku')
Events
When your application discovers new products in Magento you should dispatch one of the following events:
\JustBetter\MagentoProducts\Events\ProductDiscoveredEvent
containing a single sku.
When a single product or multiple products appear in Magento, an event is dispatched:
\JustBetter\MagentoProducts\Events\ProductCreatedInMagentoEvent
containing a single sku.
Quality
To ensure the quality of this package, run the following command:
composer quality
This will execute three tasks:
- Makes sure all tests are passed
- Checks for any issues using static code analysis
- Checks if the code is correctly formatted
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.