Download the PHP package justbetter/laravel-akeneo-products without Composer
On this page you can find all versions of the php package justbetter/laravel-akeneo-products. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download justbetter/laravel-akeneo-products
More information about justbetter/laravel-akeneo-products
Files in justbetter/laravel-akeneo-products
Package laravel-akeneo-products
Short Description Easily export products to Akeneo from your ERP
License MIT
Homepage https://github.com/justbetter/laravel-akeneo-products
Informations about the package laravel-akeneo-products
Laravel Akeneo Products
Easily export products to Akeneo from your ERP.
This package is built to easily create products in Akeneo from your ERP or other (external) source, without the complexity of the different field types in Akeneo. The structure of attributes is all taken care of by the package. This means that a simple key-value array is already sufficient to start upserting products.
Aside from attributes, you can also set a family, categories and all other data you would normally be able to via the API.
For more advanced use cases, it is also possible to add your own data to the payload.
Products are retrieved and updated in small chunks to spread the load if your project has access to a lot of products. Updates of these products are only sent to Akeneo if something has been modified to prevent unnecessary requests.
Prerequisites
This package makes use of the Akeneo Client. Make sure to follow it's README to install and configure it correctly.
Installation
Install the composer package.
Setup
Publish the configuration of the package.
Add the following commands to your scheduler.
How it works
This section will describe the process of products but product models will be similar in usage.
When a product is retrieved, it will fetch the product from the (external) source. If the retrieved data is not null, it will be saved in the database. If the payload of the database model has been changed, the update
-property of the model will be set to true
. This way, the package is aware of updates and can do them in small batches. The numbers can be tweaked in your retriever class.
When a product has already been retrieved in the past, the retrieve
-property of the model can be set to true
in order to automatically fetch the data again. This is done by the ProcessProductsCommand
, if added to your scheduler.
All products saved in the database will be processed under the following conditions:
- If
retrieve
is set totrue
, the product will be fetched again from the (external) source. - If
update
is set totrue
, the product will be upserted to Akeneo.
This package does not contain a way to retrieve "all" products. If you wish to retrieve all products daily, you will have to dispatch the RetrieveProductJob
with an identifier yourself.
Retrieving products
First, start by creating your own retriever as this is how the package will be interacting with the (external) source.
By building up a ProductData
class, the package knows how to send this data to Akeneo.
Make sure you have set your retriever in the configuration file.
This package also ships with an Attribute
model, which is meant to dynamically create the payload. We have also written a Nova integration to make this even easier as it provides a mapping resource.
Example
This is an example of how this package can be used, using a configured attribute mapping.
Product models can be implemented similarly use the following example:
Supported attribute types
Currently, the following attribute types are supported by this package:
pim_catalog_text
pim_catalog_textarea
pim_catalog_number
pim_catalog_metric
pim_catalog_boolean
pim_catalog_price_collection
pim_catalog_simpleselect
pim_catalog_multiselect
Commands
This package ships with a few commands.
Products
Retrieve a product by it's identifier, it will automatically be saved to the database.
Process all products, this includes retrieving and updating products.
Update a product by it's identifier. This will manually trigger an update towards Akeneo, regardless if the product is up-to-date.
Product models
Retrieve a product model by it's code, it will automatically be saved to the database.
Process all product models, this includes retrieving and updating product models.
Update a product model by it's code. This will manually trigger an update towards Akeneo, regardless if the product model is up-to-date.
Quality
To ensure the quality of this package, run the following command:
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
- Ramon Rietdijk
- Vincent Boon
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-akeneo-products with dependencies
justbetter/laravel-akeneo-client Version ^1.1
justbetter/laravel-error-logger Version ^2.3
laravel/framework Version ^10.0|^11.0
spatie/laravel-activitylog Version ^4.7