PHPackages                             stevenberg/responsible-images - 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. [Image &amp; Media](/categories/media)
4. /
5. stevenberg/responsible-images

ActiveLibrary[Image &amp; Media](/categories/media)

stevenberg/responsible-images
=============================

A PHP library for generating responsive image URLs and HTML tags

5.1.0(10mo ago)11.3k1MITPHPPHP ^8.2CI failing

Since Mar 16Pushed 2w ago1 watchersCompare

[ Source](https://github.com/stevenberg/responsible-images-php)[ Packagist](https://packagist.org/packages/stevenberg/responsible-images)[ RSS](/packages/stevenberg-responsible-images/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (10)Versions (30)Used By (1)

Responsible Images
==================

[](#responsible-images)

A PHP for generating responsive image URLs and HTML tags.

Installation
------------

[](#installation)

Install with composer:

```
composer require stevenberg/responsible-images
```

Use Cloudinary images with [stevenberg/responsible-images-cloudinary](https://github.com/stevenberg/responsible-images-cloudinary-php):

```
composer require stevenberg/responsible-images-cloudinary
```

Example
-------

[](#example)

Here's an example of using the library in a Laravel project:

```
// app/Providers/ResponsibleImagesServiceProvider.php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use StevenBerg\ResponsibleImages\Urls\Cloudinary;
use StevenBerg\ResponsibleImages\Urls\Maker;

class ResponsibleImagesServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Maker::registerDefaultMaker(new Cloudinary);
    }
}
```

```
// app/Image.php

namespace App;

use Illuminate\Database\Eloquent\Model;
use StevenBerg\ResponsibleImages\Image as ResponsibleImage;
use StevenBerg\ResponsibleImages\Urls\Cloudinary;
use StevenBerg\ResponsibleImages\Values\Gravity;
use StevenBerg\ResponsibleImages\Values\Shape;

class Image extends Model
{
    protected $fillable = ['gravity', 'name', 'shape'];

    public function getGravityAttribute($value)
    {
        return Gravity::from($value);
    }

    public function setGravityAttribute(Gravity $value)
    {
        $this->attributes['gravity'] = $value->value;
    }

    public function getShapeAttribute($value)
    {
        return new Shape($value);
    }

    public function setShapeAttribute(Shape $value)
    {
        $this->attributes['shape'] = $value->value;
    }

    public function getResponsiveImageAttribute()
    {
        return ResponsibleImage::fromShape(
            $this->shape,
            $this->name,
            ['gravity' => $this->gravity]
        );
    }
}
```

```
// app/helpers.php

use App\Image;
use StevenBerg\ResponsibleImages\SizeRange;

function responsive_image_tag(
    Image $image,
    int $min,
    int $max,
    int $step,
    array $attributes)
{
    $range = SizeRange::from($min, $max, $step);

    echo $image->responsive_image->tag($range, $range->first(), $attributes);
}
```

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance78

Regular maintenance activity

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% 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 ~110 days

Recently: every ~402 days

Total

29

Last Release

308d ago

Major Versions

0.5.3 → 1.0.02017-04-26

1.1.0 → 2.0.02018-02-28

2.0.1 → 3.0.02019-12-23

3.3.0 → 4.0.02023-04-25

4.0.0 → 5.0.02024-08-01

PHP version history (6 changes)0.1.0PHP &gt;=7.0.0

1.0.2PHP &gt;=7.1.0

3.0.0PHP ^7.1

3.2.0PHP ^7.4 | ^8.0

3.3.0PHP ^8.0

5.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6774fe24d7939f74fc0599aed9fc5b62fe62c5b3433372e51469f058c54309be?d=identicon)[stevenberg](/maintainers/stevenberg)

---

Top Contributors

[![stevenberg](https://avatars.githubusercontent.com/u/2222?v=4)](https://github.com/stevenberg "stevenberg (77 commits)")

---

Tags

imagesresponsive

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/stevenberg-responsible-images/health.svg)

```
[![Health](https://phpackages.com/badges/stevenberg-responsible-images/health.svg)](https://phpackages.com/packages/stevenberg-responsible-images)
```

###  Alternatives

[rosell-dk/webp-convert

Convert JPEG &amp; PNG to WebP with PHP

6058.7M59](/packages/rosell-dk-webp-convert)[mindkomm/timmy

Advanced image manipulation for Timber.

17737.1k](/packages/mindkomm-timmy)[mmo/faker-images

Different images provider for Faker

56403.1k7](/packages/mmo-faker-images)[schnitzler/fluid-styled-responsive-images

Enables creation of responsive images for fluid styled content elements.

279.8k1](/packages/schnitzler-fluid-styled-responsive-images)[spacecatninja/imager-x

Ninja powered image transforms.

29399.9k35](/packages/spacecatninja-imager-x)[spatie/pixelmatch-php

Compare images using PHP

5896.4k16](/packages/spatie-pixelmatch-php)

PHPackages © 2026

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