Download the PHP package setono/sylius-image-optimizer-plugin without Composer
On this page you can find all versions of the php package setono/sylius-image-optimizer-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download setono/sylius-image-optimizer-plugin
More information about setono/sylius-image-optimizer-plugin
Files in setono/sylius-image-optimizer-plugin
Package sylius-image-optimizer-plugin
Short Description Sylius plugin that optimizes your images
License MIT
Informations about the package sylius-image-optimizer-plugin
Sylius Image Optimizer Plugin
Optimize the images in your Sylius store! Works only with kraken.io at the moment, but will work with other vendors in the future.
Have you seen this message from Google page speed tools: "Serve images in next-gen formats", this is the plugin to use.
It will both optimize your jpegs, but also convert them to webp and serve the webp images to browsers that support webp (i.e. Chrome).
Installation
Step 1: Download the plugin
This will also install the Kraken.io Bundle which is need for configuring the API keys.
Step 2: Enable the plugin
Then, enable the plugin by adding it to the list of registered plugins/bundles
in the config/bundles.php
file of your project:
Make sure you add it before SyliusGridBundle
, otherwise you'll get
You have requested a non-existent parameter "setono_sylius_image_optimizer.model.savings.class".
exception.
Step 3: Configure the plugin
Add the resources (image resources) that should be optimized. In the example below a product image is optimized and the filter sets that are optimized are the default frontend filter sets for products.
This is also the step where you need your API key and secret from kraken.io.
Step 4: Configure Symfony Messenger
If you haven't used Symfony Messenger before, you need to specify a default bus like so:
Step 4.1: Using asynchronous transport (optional, but recommended)
All commands in this plugin will extend the CommandInterface and all events will extend the EventInterface.
Therefore, you can route all commands and events easily by adding this to your Messenger config:
Step 5: Extend image resources
The following example is for the product images. You should follow this procedure for all image resources you want to optimize.
Step 6: Update database
Last step is to create a diff for your current database schema and migrate that schema.
Usage
Now run this command to optimize your images:
Testing
If you want to test this plugin you can setup ngrok to tunnel requests to your localhost:
- Download and install ngrok
- Run your local web server:
symfony serve --allow-http
(theallow-http
is important since ngrok always tunnels to the non secure localhost) - Run ngrok:
ngrok http 8000
All versions of sylius-image-optimizer-plugin with dependencies
ext-mbstring Version *
doctrine/common Version ^2.13 || ^3.0
doctrine/event-manager Version ^1.1
doctrine/orm Version ^2.7
doctrine/persistence Version ^1.3 || ^2.0
knplabs/knp-menu Version ^3.1
liip/imagine-bundle Version ^2.3
psr/container Version ^1.0
psr/log Version ^1.1
setono/doctrine-orm-batcher Version ^0.6
setono/doctrine-orm-batcher-bundle Version ^0.3.1
setono/kraken-io-bundle Version ^1.0
setono/kraken-io-php-sdk Version ^1.1
sylius/resource-bundle Version ^1.6
symfony/config Version ^4.4 || ^5.0
symfony/console Version ^4.4 || ^5.0
symfony/dependency-injection Version ^4.4 || ^5.0
symfony/event-dispatcher Version ^4.4 || ^5.0
symfony/http-client-contracts Version ^2.3
symfony/http-foundation Version ^4.4 || ^5.0.7
symfony/lock Version ^4.4 || ^5.0
symfony/messenger Version ^4.4 || ^5.0
symfony/mime Version ^4.4 || ^5.0
symfony/routing Version ^4.4 || ^5.0
symfony/service-contracts Version ^2.2
thecodingmachine/safe Version ^1.0
twig/twig Version ^2.14
webimpress/safe-writer Version ^2.0