Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Webp Conversion Bundle Laravel Package

094ikis09/webp-conversion-bundle

View on GitHub
Deep Wiki
Context7

Code Coverage Badge

WebP Conversion Command

This bundle is here to make it easy to create webP images in a Symfony project.

Command

The bundle contains one command so far. codebuds:webp:convert.

This will allow you to pass a directory in which you want all the jpeg, png, gif and bmp images to be converted to webP.

It has multiple parameters :

  • --create without this the directories will be checked, but the final images will not be created.
  • --quality set the quality for the webp images (80 by default)
  • --force recreate existing webP images (false by default)
  • --suffix add a suffix to the created webp image names

Example:

php bin/console codebuds:webp:convert --create --quality=90 --suffix=_q90 public/images

if the public/images contains image.jpeg, after the command it will contain image_q90.webp.

Twig extension

The bundle contains a twig extension that will generate the webp image and return the path to it. This helps to easily generate the elements to optimize the websites rendering speed.

<!-- old school approach -->
<img src="/public/images/test.jpg">

<!-- new approach -->
<picture>
    <source srcset="{{ '/public/images/test.jpg' | cb_webp }}" type="image/webp">
    <source srcset="/public/images/test.jpg"  type="image/jpeg">
    <img src="/public/images/test.jpg">
</picture>

This also works with vich_uploader assets and liip_imagine filters :

<picture>
    <source srcset="{{ vich_uploader_asset(asset, 'imageFile') | cb_webp | set_webp_extension | imagine_filter(filter) }}" type="image/webp">
    <source srcset="{{ vich_uploader_asset(asset, 'imageFile') | imagine_filter(filter) }}">
    <img src="{{ vich_uploader_asset(asset, 'imageFile') | imagine_filter(filter) }}">
</picture>
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor