justbetter/laravel-akeneo-images

Upload images automatically to Akeneo

1.1.0 2024-03-29 12:54 UTC

This package is auto-updated.

Last update: 2024-10-19 14:47:06 UTC


README

Package banner

Laravel Akeneo images

Tests Coverage Analysis Total downloads

This package is used to download images from a storage disk configured in the config/filesystems.php of your Laravel project and upload them to your Akeneo PIM.

How it works

The process of setting images in Akeneo consists of two steps.

In order to set images, the disk and path are saved with a checksum of the file in the database. This way we prevent uploading the same image over and over again.

Next, the image will be uploaded. By using the information stored in the database, the data is sent over to Akeneo.

Installation

You can install the package via composer.

composer require justbetter/laravel-akeneo-images

Setup

If you wish to configure the queue of jobs, publish the configuration of this package.

php artisan vendor:publish --provider="JustBetter\AkeneoImages\ServiceProvider" --tag=config

Configuration

Make sure you have a disk configured in your config/filesystems.php.

Set up your Akeneo connection. More information can be found here.

Implementation

In order to start processing images, the ProcessImageJob has to be dispatched. This is the only thing you'll have to do when using the default functionalities.

<?php

use JustBetter\AkeneoImages\Jobs\ProcessImageJob;

ProcessImageJob::dispatch('disk', '/path/to/image.jpeg', [
    'identifier' => 'sku',
    'attribute' => 'image',
    'type' => 'product',
    'scope' => null,
    'locale' => null,
]);

The third parameter is an array which represents the $meta. This is used in the UploadImageJob in order to determine where the image has to be uploaded to.

The UploadImageJob is automatically dispatched by the ProcessImage action when the image passes validation, so there is no need to dispatch this manually.

Commands

This package also ships with a few commands.

php artisan akeneo-image:process {disk} {path} {--force}
php artisan akeneo-image:upload {image-id}

Quality

To ensure the quality of this package, run the following command:

composer quality

This will execute three tasks:

  1. Makes sure all tests are passed
  2. Checks for any issues using static code analysis
  3. 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.

Package footer