PHPackages                             almeyda/html-picture-element - 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. almeyda/html-picture-element

ActivePhp-extension[Utility &amp; Helpers](/categories/utility)

almeyda/html-picture-element
============================

Generates picture html tag with different types of sources

217PHP

Since Nov 23Pushed 2y ago2 watchersCompare

[ Source](https://github.com/willarin/html-picture-element)[ Packagist](https://packagist.org/packages/almeyda/html-picture-element)[ RSS](/packages/almeyda-html-picture-element/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Description
===========

[](#description)

A simple PHP class to generate the HTML *&lt;picture*&gt; element with different source types supported. It could be used for optimization of image rendering depending on the browser supporting one or another image format.

Installation
============

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Place **composer.phar** file in the same directory with **composer.json** file and run

```
$ php composer.phar require almeyda/html-picture-element "*"

```

or add

```
{
    ...
    "require": {
        ...
        "almeyda/html-picture-element": "dev-master"
        ...
    }
    ...
}

```

to the *"require"* section of your `composer.json` file and run

```
$ php composer.phar update

```

Usage
=====

[](#usage)

```
\almeyda\htmlpicture\src\HtmlPicture::get($src, $attributes, $sourceTypes);

```

Where:

- src - path to main image
- attributes - "&lt;image"&gt; tag attributes
- sourceTypes - array of the image types to be collected into picture sources

### Example of usage:

[](#example-of-usage)

```
\almeyda\htmlpicture\src\HtmlPicture::get('path/to/image.png', ['alt' => 'Image alt'], ['webp', 'jp2', 'jpx']),

```

This produces an output like

```

```

You can define image types to be collected and rendered into picture tag once using a method setSouceTypes

```
\almeyda\htmlpicture\src\HtmlPicture::setSouceTypes(['webp', 'jp2', 'jpx']);

...

\almeyda\htmlpicture\src\HtmlPicture::get('path/to/image1.png'),

\almeyda\htmlpicture\src\HtmlPicture::get('path/to/image2.png'),

```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor1

Top contributor holds 58.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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/41fe2e71f30acc9ad324f0898720cdd250d17b0742ea7616bc1a7facb3e1a47d?d=identicon)[solutlux](/maintainers/solutlux)

---

Top Contributors

[![vramil](https://avatars.githubusercontent.com/u/8470191?v=4)](https://github.com/vramil "vramil (7 commits)")[![willarin](https://avatars.githubusercontent.com/u/6641982?v=4)](https://github.com/willarin "willarin (5 commits)")

### Embed Badge

![Health badge](/badges/almeyda-html-picture-element/health.svg)

```
[![Health](https://phpackages.com/badges/almeyda-html-picture-element/health.svg)](https://phpackages.com/packages/almeyda-html-picture-element)
```

PHPackages © 2026

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