PHPackages                             8ctopus/webp8 - 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. 8ctopus/webp8

ActiveApplication

8ctopus/webp8
=============

command line tool to convert images to webp

1.2.0(5mo ago)7184MITPHPCI failing

Since Jul 9Pushed 5mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (16)Used By (0)

webp8
=====

[](#webp8)

[![license](https://camo.githubusercontent.com/70d06c91e214e01a888403e71a8fa60cba58089651a812c02a447078fe84a041/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f77656270382f6c6963656e7365)](https://packagist.org/packages/8ctopus/webp8)[![lines of code](https://raw.githubusercontent.com/8ctopus/webp8/image-data/lines.svg)](https://raw.githubusercontent.com/8ctopus/webp8/image-data/lines.svg)

webp8 is a command line tool to convert images to webp format

how to install
--------------

[](#how-to-install)

You have the choice between:

- composer install `composer require 8ctopus/webp8`
- download the phar
- or build it yourself

```
curl -LO https://github.com/8ctopus/webp8/releases/download/1.2.0/webp8.phar

# check hash against the one published under releases
sha256sum webp8.phar

# make phar executable
chmod +x webp8.phar

# rename phar (from here on optional)
mv webp8.phar webp8

# move phar to /usr/local/bin/ (optional)
mv webp8 /usr/local/bin/
```

### Windows only

[](#windows-only)

- download and extract cwebp.exe from [libwebp](https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.0-windows-x64.zip)
- add `cwebp.exe` to PATH (`sysdm.cpl` -&gt; `Advanced` -&gt; `Environment Variables`)
- download webp8

```
curl -LO https://github.com/8ctopus/webp8/releases/download/1.2.0/webp8.phar
```

- check hash against the one published under releases

convert images to webp
----------------------

[](#convert-images-to-webp)

```
./webp8 convert [--cwebp_m] [-cwebp_q] [--cwebp_z] [--multithreading] directory

[▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 15843/15843 (100%) -   1 hr/1 hr   - 6.0 MiB

[OK]

------- ----------- --------- ------------- ------- --------------- -----------
 total   converted   skipped   webp bigger   time    size original   size webp
------- ----------- --------- ------------- ------- --------------- -----------
 15843   15843       0         235           64:20   1.2 GB          150.3 MB
------- ----------- --------- ------------- ------- --------------- -----------
```

*NOTE*: converted images that are bigger in webp format are automatically deleted since the whole point is to get smaller images. You can see the bigger images in the `webp bigger` column.

delete existing webp images
---------------------------

[](#delete-existing-webp-images)

```
./webp8 cleanup [--dry-run] [-v] directory
```

htaccess code to show webp instead of png/jpg when browser supports
===================================================================

[](#htaccess-code-to-show-webp-instead-of-pngjpg-when-browser-supports)

Code adapted from [webp-express](https://github.com/rosell-dk/webp-express)

```
RewriteEngine On

# redirect images to webp when possible
# check if browser accepts webp
RewriteCond %{HTTP_ACCEPT} image/webp

# check if requested file is jpg or png
RewriteCond %{REQUEST_FILENAME} \.(jpe?g|png)$

# check if webp for image exists
RewriteCond %{REQUEST_FILENAME}\.webp -f

# serve webp image instead
RewriteRule . %{REQUEST_FILENAME}\.webp [T=image/webp,E=EXISTING:1,E=ADDVARY:1,L]

# make sure that browsers which do not support webp also get the Vary:Accept header
# when requesting images that would be redirected to existing webp on browsers that does.
SetEnvIf Request_URI "\.(jpe?g|png)$" ADDVARY

# Apache appends "REDIRECT_" in front of the environment variables defined in mod_rewrite, but LiteSpeed does not.
# So, the next lines are for Apache, in order to set environment variables without "REDIRECT_"
SetEnvIf REDIRECT_EXISTING 1 EXISTING=1
SetEnvIf REDIRECT_ADDVARY 1 ADDVARY=1

# Set Vary:Accept header for the image types handled by WebP Express.
# The purpose is to make proxies and CDNs aware that the response varies with the Accept header.
Header append "Vary" "Accept" env=ADDVARY

```

for development
---------------

[](#for-development)

### build bin

[](#build-bin)

- bump version
- run `./build.sh`

### debug code

[](#debug-code)

```
php src/EntryPoint.php convert -- images

# cleanup test dir
git clean -xfd images

```

improvement ideas
-----------------

[](#improvement-ideas)

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance71

Regular maintenance activity

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 98.3% 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 ~141 days

Recently: every ~222 days

Total

15

Last Release

162d ago

Major Versions

0.1.8 → 1.0.02023-06-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dafd5f7ef8134a5c9b231686c5da3d6416db09139b45aac0b26952178dffb8a?d=identicon)[8ctopus](/maintainers/8ctopus)

---

Top Contributors

[![8ctopus](https://avatars.githubusercontent.com/u/13252042?v=4)](https://github.com/8ctopus "8ctopus (169 commits)")[![accountuse](https://avatars.githubusercontent.com/u/82091298?v=4)](https://github.com/accountuse "accountuse (2 commits)")[![mstraczkowski](https://avatars.githubusercontent.com/u/1781892?v=4)](https://github.com/mstraczkowski "mstraczkowski (1 commits)")

---

Tags

command-line-toolphpwebpWebpcwebpimage-conversion

### Embed Badge

![Health badge](/badges/8ctopus-webp8/health.svg)

```
[![Health](https://phpackages.com/badges/8ctopus-webp8/health.svg)](https://phpackages.com/packages/8ctopus-webp8)
```

###  Alternatives

[rosell-dk/webp-convert

Convert JPEG &amp; PNG to WebP with PHP

6038.1M54](/packages/rosell-dk-webp-convert)[rosell-dk/webp-convert-cloud-service

Cloud service for converting JPEG &amp; PNG to WebP

545.6k3](/packages/rosell-dk-webp-convert-cloud-service)[buglinjo/laravel-webp

Laravel package for WebP image formatting.

179236.1k2](/packages/buglinjo-laravel-webp)[codeblog/conveter-php-webp

Easy WebP conversion library for PHP

124.1k1](/packages/codeblog-conveter-php-webp)[choowx/rasterize-svg

A PHP library for converting SVG to JPEG, PNG, and WEBP

2261.7k](/packages/choowx-rasterize-svg)[christianbarkowsky/contao-tiny-compress-images

This plugin automatically optimizes your images (JPG, PNG, WebP) by integrating with the popular image compression services TinyJPG and TinyPNG.

2719.0k](/packages/christianbarkowsky-contao-tiny-compress-images)

PHPackages © 2026

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