Download the PHP package enjoydev/bolt-webp without Composer

On this page you can find all versions of the php package enjoydev/bolt-webp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bolt-webp

Bolt WebP Converter

Bolt CMS PHP License

A Bolt CMS extension that automatically converts images to WebP format with customizable thumbnails, fit modes, and quality settings.

Features

Requirements

Installation

1. Install via Composer

2. Clear the cache

After installation, clear the cache to register the new Twig filter:

3. Verify installation

Ensure the extension is loaded:

You should see EnjoyDev\BoltWebp\Extension in the list.

Configuration

This extension works out of the box with sensible defaults. No configuration file is required. If you need to adjust quality or default paths, you can do so directly in your Twig templates.

Usage

The webp_thumbnail filter returns a WebPImage object. This object contains the path, dimensions, and metadata, but can be used as a string for backward compatibility.

Basic Usage

Accessing Dimensions & Metadata (v1.0.1+)

Because the filter returns an object, you can easily access the width, height, and Alt text of the generated WebP image.

Fit Modes

Mode Parameter Description
Max (default) 'm' or 'max' Fits within bounds without upscaling smaller images
Crop 'c' Resizes to fill dimensions and crops excess data
Contain 'n' or 'contain' Fits image within bounds, maintains aspect ratio
Fill 'f' or 'fill' Fits within bounds, fills empty space with white background
Stretch 's' or 'stretch' Stretches exactly to dimensions (distorts image)

Single Dimension

If you specify only one dimension, the other will be calculated automatically to maintain aspect ratio:

Custom Output Directory

You can specify a custom directory for the WebP files:

Responsive Images (Picture Element)

This is the recommended way to use WebP for better performance. You can still use the object directly in srcset.

Advanced Example (Multiple Sizes)

How It Works

  1. Extract image – Gets the image path from Bolt field types (ImageField, Image, FieldTranslation)
  2. Calculate dimensions – Processes width/height parameters and fit mode
  3. Generate filename – Creates unique filename with hash based on parameters
  4. Check cache – Returns existing WebP file if it exists
  5. Convert – Converts original image directly to WebP using GD library
  6. Save – Stores WebP file in the public directory (usually public/thumbs)
  7. Return Object – Returns WebPImage object containing path, width, height, and alt text

File Naming Convention

The extension generates filenames in this format:

Where hash is an 8-character MD5 hash based on dimensions, fit mode, quality, and original filename.

Example:

Maintenance

WebP files are generated once and stored permanently on your server. If you frequently update images or change dimensions, you might want to clean up old files.

Cleaning up old files

You can remove unused WebP files by deleting the contents of the public/thumbs directory (or your custom directories) via FTP or a command line tool.

Example command to remove all generated thumbnails:

Note: Be careful not to delete folders that contain manually uploaded files if you use overlapping paths.

Troubleshooting

WebP files not being generated

Ensure GD is installed with WebP support:

You should see WebP Support => enabled.

Allowed memory size exhausted

If you are processing very large images (e.g., 4000px+), PHP might run out of memory. Increase the memory limit in your php.ini:

Or temporarily in your script (not recommended for production):

Permission issues

Ensure the web server has write permissions to the output directories (usually public/thumbs):

Images not showing up

Check the Bolt logs for conversion errors:

Support

Found a bug or have a feature request? Please report it on the GitHub issue tracker.

License

This extension is released under the MIT License.

Credits

Developed by EnjoyDev for the Bolt CMS community.


All versions of bolt-webp with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-gd Version *
bolt/core Version ^5.2|^6.0
twig/twig Version ^2.0|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package enjoydev/bolt-webp contains the following files

Loading the files please wait ...