PHPackages                             buglinjo/laravel-webp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. buglinjo/laravel-webp

ActiveLibrary

buglinjo/laravel-webp
=====================

Laravel package for WebP image formatting.

v3.2.0(2mo ago)179236.1k↓31%352MITPHPPHP ^8.0|^8.1CI failing

Since Aug 31Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/buglinjo/laravel-webp)[ Packagist](https://packagist.org/packages/buglinjo/laravel-webp)[ Docs](https://github.com/buglinjo/laravel-webp)[ RSS](/packages/buglinjo-laravel-webp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (24)Used By (2)

[![](https://camo.githubusercontent.com/2bedf63f24cda7efab02da955dc11fb7ef8a060e2f26b73c33a7aac84529b8a3/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f737570706f72742d756b7261696e652e7376673f743d31)](https://supportukrainenow.org)

WebP (.webp) comes to Laravel
-----------------------------

[](#webp-webp-comes-to-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/058873131a7f7d6e8398fec31040d56f9d68512c052c18183a0c162c37a5ce3d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6275676c696e6a6f2f6c61726176656c2d776562702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/buglinjo/laravel-webp)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/2e3c25456f9a72ab801b713bfcda3507ed59a4759d55908ae1ad01cd1d335934/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6275676c696e6a6f2f6c61726176656c2d776562702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/buglinjo/laravel-webp)

About
-----

[](#about)

WebP is a modern image format that provides superior lossless and lossy compression for images on the web. Using WebP, webmasters and web developers can create smaller, richer images that make the web faster.

WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent SSIM quality index.

Lossless WebP supports transparency (also known as alpha channel) at a cost of just 22% additional bytes. For cases when lossy RGB compression is acceptable, lossy WebP also supports transparency, typically providing 3× smaller file sizes compared to PNG.

`cwebp` compresses an image using the WebP format. Input format can be either `PNG`, `JPEG`, `TIFF`, `WebP` or raw `Y'CbCr` samples.

Before Installation
-------------------

[](#before-installation)

### New Driver Is Available: `php-gd`

[](#new-driver-is-available-php-gd)

Currently, supports 2 drivers:

- `php-gd` - Only needs `gd` - PHP extension to be installed
- `cwebp` - uses Google native `cwebp` cli command

Note: If you choose to use cwebp driver you will need to install WebP before installing this package.
For more information you can visit this [page](https://developers.google.com/speed/webp/)

Install
-------

[](#install)

Via Composer

```
$ composer require buglinjo/laravel-webp
```

#### For Laravel &lt;= 5.4

[](#for-laravel--54)

After updating composer, add the ServiceProvider to the providers array in config/app.php

```
Buglinjo\LaravelWebp\WebpServiceProvider::class,
```

You can use the facade for shorter code. Add this to your aliases:

```
'Webp' => Buglinjo\LaravelWebp\Facades\Webp::class,
```

#### Publish config file

[](#publish-config-file)

You will need to publish config file to add `cwebp` global path.

```
php artisan vendor:publish --provider="Buglinjo\LaravelWebp\WebpServiceProvider" --tag=config

```

In `config/laravel-webp.php` config file you should set `cwebp` global path.

```
return [
    /*
    |--------------------------------------------------------------------------
    | Default Quality
    |--------------------------------------------------------------------------
    |
    | This is a default quality unless you provide while generation of the WebP
    |
    */
    'default_quality' => 70,

    /*
    |--------------------------------------------------------------------------
    | Default Driver
    |--------------------------------------------------------------------------
    |
    | This is a default image processing driver. Available: ['cwebp', 'php-gd']
    |
    */
    'default_driver' => 'php-gd',

    /*
    |--------------------------------------------------------------------------
    | Drivers
    |--------------------------------------------------------------------------
    |
    | Available drivers which can be selected
    |
    */
    'drivers' => [

        /*
        |--------------------------------------------------------------------------
        | Cwebp Driver
        |--------------------------------------------------------------------------
        |
        | If you choose cwebp driver it is required to specify the path to the executable.
        |
        */
        'cwebp' => [
            'path' => '/usr/local/bin/cwebp',
        ],

        /*
        |--------------------------------------------------------------------------
        | Cwebp Driver
        |--------------------------------------------------------------------------
        |
        | If you choose PHP GD driver no configuration is necessary.
        |
        */
        'php-gd' => [
            //
        ],
    ],
];
```

Usage
-----

[](#usage)

```
Webp::make()->save(, );
```

Note: `UploadedFile` class instance is created when file is retrieved using laravel request.

Example:

```
    $webp = Webp::make($request->file('image'));

    if ($webp->save(public_path('output.webp'))) {
        // File is saved successfully
    }
```

where `` is 0 - 100 integer. 0 - lowest quality, 100 - highest quality.

Default `quality` is 70

Also you can set `quality` by chaining `->quality()` between `WebP::make()`and `->save();`

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance84

Actively maintained with recent releases

Popularity53

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 65% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~147 days

Recently: every ~180 days

Total

22

Last Release

82d ago

Major Versions

v1.0.8 → v2.0.02019-07-03

v2.3.4 → v3.0.02024-05-28

PHP version history (5 changes)v1.0.2PHP ~5.6|~7.0

v2.0.0PHP ~7.1

2.1PHP ~7.1|^8.0

2.3PHP ^7.1|^8.0|^8.1

v3.0.0PHP ^8.0|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f59bf53cb69c73e2a8a8c055de3b268f54a8500126875a38081d1c5215d4b085?d=identicon)[buglinjo](/maintainers/buglinjo)

---

Top Contributors

[![buglinjo](https://avatars.githubusercontent.com/u/1254208?v=4)](https://github.com/buglinjo "buglinjo (26 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (5 commits)")[![terax6669](https://avatars.githubusercontent.com/u/19204073?v=4)](https://github.com/terax6669 "terax6669 (3 commits)")[![abdallhsamy](https://avatars.githubusercontent.com/u/8833767?v=4)](https://github.com/abdallhsamy "abdallhsamy (2 commits)")[![mahammad](https://avatars.githubusercontent.com/u/5662768?v=4)](https://github.com/mahammad "mahammad (1 commits)")[![mokalovesoulmate](https://avatars.githubusercontent.com/u/696744?v=4)](https://github.com/mokalovesoulmate "mokalovesoulmate (1 commits)")[![samuel-lujan](https://avatars.githubusercontent.com/u/17858893?v=4)](https://github.com/samuel-lujan "samuel-lujan (1 commits)")[![jelhan](https://avatars.githubusercontent.com/u/4965703?v=4)](https://github.com/jelhan "jelhan (1 commits)")

---

Tags

laravelWebpBuglinjoLaravelWebp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/buglinjo-laravel-webp/health.svg)

```
[![Health](https://phpackages.com/badges/buglinjo-laravel-webp/health.svg)](https://phpackages.com/packages/buglinjo-laravel-webp)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11120.2M21](/packages/anourvalar-eloquent-serialize)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
