Open Source / PHP Package · Year 2026
WebpBolt: PHP & Laravel WebP Image Converter
Visit live website
Overview
WebpBolt is an open-source PHP package I built to convert JPG, PNG, GIF and BMP images to WebP. It works in any PHP 8.1+ project and has a built-in Laravel integration with auto-discovery, a config file and an Artisan command. It has zero dependencies and runs on PHP's native GD extension. Install it with: composer require shykat199/webpbolt
The client's problem
Image-heavy sites like photography portfolios and e-commerce stores have thousands of large JPG and PNG uploads, which hurt page speed and Core Web Vitals. WebP files are usually 25–35% smaller, but existing tools either converted one image at a time, needed heavy dependencies like Imagick, or could not safely process a live uploads folder again and again. I needed a lightweight tool that converts a whole folder tree, never makes an image bigger, and can run on a schedule.
What I built
- Convert JPG, JPEG, PNG, GIF and BMP to WebP with adjustable quality (0–100)
- Fluent API: WebpBolt::make('photo.jpg')->resize(1600)->quality(85)->save()
- Batch mode to convert a whole folder tree in one call
- Dry-run preview that counts files without writing anything
- Progress reporting with a callback for every file
- Resumable runs: already-converted files are skipped, so it's safe on cron
- Automatically discards output that is larger than the original
- Text and logo watermarks with 9 positions, opacity, margin and scale
- Transforms: resize (keeps aspect ratio, never enlarges), grayscale and auto-orient for phone photos
- Keeps PNG transparency
- Pixel limit protection against very large images
- Pluggable encoders, so new formats like AVIF can be added
- Laravel integration: auto-discovery, publishable config and php artisan images:webp command
- Artisan options: --dry, --force and --no-watermark, and it can run from the Laravel scheduler
- Clear exceptions for missing files, unsupported formats and failed encoding
- Tests written with Pest
Tech used
PHP 8.1, GD, Laravel, Composer, Pest, WebP
Results
- One Artisan command converts an entire uploads folder to WebP
- Repeat runs skip finished files, so scheduled runs are fast
- Images never get bigger after conversion
- Zero dependencies: works on any server with PHP GD
- Open source under the MIT licence
Want something like this for your business?
Book a free 15-minute call and we can talk through what you need.
Book a free 15-min call