PHPackages                             mapado/image-url-builder - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mapado/image-url-builder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mapado/image-url-builder
========================

Generate a full url from an image slug

v2.3.0(1y ago)112.2k↓33.3%1MITPHPPHP ^7.2 || ^8.0CI passing

Since Jul 11Pushed 1y ago2 watchersCompare

[ Source](https://github.com/mapado/image-url-builder)[ Packagist](https://packagist.org/packages/mapado/image-url-builder)[ RSS](/packages/mapado-image-url-builder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (10)Used By (0)

image-url-builder
=================

[](#image-url-builder)

Generate a full url from an image slug

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

[](#installation)

```
composer require mapado/image-url-builder
```

Usage
-----

[](#usage)

```
use Mapado\ImageUrlBuilder\Builder;

$builder = new Builder();

$width = 800;
$height = 600;
$url = $builder->buildUrl('2018/01/foo.jpg', $width, $height);

// will output '//img.mapado.net/2018/01/foo_thumbs/800-600.jpg'
```

The first parameter of the `buildUrl` function accept an image "slug" or a full image url (starting with `https://img.mapado.net/`)

### Force http(s) prefix

[](#force-https-prefix)

If you want to force http prefix, you can use the `withHttpPrefix()` or `withHttpsPrefix()` function before :

```
$httpUrl = $builder
    ->withHttpPrefix()
        ->buildUrl($slug, $width, $height);
// will output `http://img.mapado.net/xxxx...`

$httpsUrl = $builder
    ->withHttpsPrefix()
        ->buildUrl($slug, $width, $height);
// will output `https://img.mapado.net/xxxx...`
```

### With Twig

[](#with-twig)

A Twig extension is available : `Mapado\ImageUrlBuilder\Twig\UrlBuilderExtension`

You need to inject an instance of `Mapado\ImageUrlBuilder\Builder` to the constructor.

If you are using Symfony, the following configuration do work fine:

```
services:
  Mapado\ImageUrlBuilder\Builder: ~

  Mapado\ImageUrlBuilder\Twig\UrlBuilderExtension:
    tags:
      - { name: twig.extension }
```

You can use the filter like this:

```

```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 59% 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 ~283 days

Recently: every ~365 days

Total

9

Last Release

603d ago

Major Versions

v1.2.1 → v2.0.02020-09-22

PHP version history (3 changes)v1.0.0PHP ^7.0

v2.0.0PHP ^7.2

v2.1.0PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3277986d0e1f93c7e8a58fdaf1b52e3f5a1588e73dfa298d33aafb1ebbde5ef2?d=identicon)[jdeniau](/maintainers/jdeniau)

![](https://www.gravatar.com/avatar/90d135128b469dc38fcf186ac78d0f2cd82fc696ffcf5be8a8c486b7bd911ff6?d=identicon)[mapado](/maintainers/mapado)

---

Top Contributors

[![jdeniau](https://avatars.githubusercontent.com/u/1398469?v=4)](https://github.com/jdeniau "jdeniau (23 commits)")[![Nickinthebox](https://avatars.githubusercontent.com/u/2796997?v=4)](https://github.com/Nickinthebox "Nickinthebox (12 commits)")[![ambroisemaupate](https://avatars.githubusercontent.com/u/380026?v=4)](https://github.com/ambroisemaupate "ambroisemaupate (4 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mapado-image-url-builder/health.svg)

```
[![Health](https://phpackages.com/badges/mapado-image-url-builder/health.svg)](https://phpackages.com/packages/mapado-image-url-builder)
```

PHPackages © 2026

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