PHPackages                             bohnmedia/contao-flag-icons-bundle - 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. bohnmedia/contao-flag-icons-bundle

ActiveContao-bundle[Utility &amp; Helpers](/categories/utility)

bohnmedia/contao-flag-icons-bundle
==================================

Contao 5 wrapper around lipis/flag-icons — render country flags via insert tag or Twig function.

v2.0.0(2mo ago)06MITPHPPHP ^8.2

Since May 1Pushed 2mo agoCompare

[ Source](https://github.com/bohnmedia/contao-flag-icons-bundle)[ Packagist](https://packagist.org/packages/bohnmedia/contao-flag-icons-bundle)[ RSS](/packages/bohnmedia-contao-flag-icons-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (7)Versions (5)Used By (0)

Contao Flag Icons Bundle
========================

[](#contao-flag-icons-bundle)

A small Contao 5 wrapper around [lipis/flag-icons](https://github.com/lipis/flag-icons). It renders country flags as `` tags via an insert tag or a Twig function.

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

[](#installation)

```
composer require bohnmedia/contao-flag-icons-bundle
```

Usage
-----

[](#usage)

### Insert tag

[](#insert-tag)

```
{{flag_icon::de}}

```

renders

```

```

More examples:

```
{{flag_icon::de::ratio=1x1}}
{{flag_icon::de::ratio=1x1::width=24}}
{{flag_icon::de::alt=Country name}}
{{flag_icon::de::alt=}}

```

### Twig

[](#twig)

```
{{ flag_icon('de') }}
{{ flag_icon('de', '1x1') }}
{{ flag_icon('de', '1x1', 24) }}
{{ flag_icon('de', alt='Country name') }}
```

The `alt` attribute is the localised country name from Contao's `Countries`service — German in a German page context, English in an English one, etc.

### Parameters

[](#parameters)

ParameterDefaultDescription`ratio``4x3`Aspect ratio of the SVG. Allowed values: `4x3`, `1x1`.`width``40`Value for the `width` attribute. The `height` attribute is computed from the ratio (e.g. `width=24` on `4x3` → `width="24" height="18"`).`alt`—Override for the `alt` attribute. Pass an empty string for decorative use.If the country code is unknown (no matching SVG in the installed library), both the insert tag and the Twig function render as an empty string.

### Styling

[](#styling)

The bundle ships no CSS. Three BEM classes are emitted on every ``:

- `flag-icon` — block-level hook for all flags
- `flag-icon--{code}` — country-specific modifier (e.g. `flag-icon--de`)
- `flag-icon--{ratio}` — ratio-specific modifier (e.g. `flag-icon--1x1`)

Use these to apply your own styles, for example:

```
.flag-icon { width: 1em; height: auto; vertical-align: -0.125em; }
.flag-icon--1x1 { border-radius: 50%; }
```

`height: auto` ensures the height re-derives from the intrinsic aspect ratio when you only set `width` in CSS.

License
-------

[](#license)

MIT.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance83

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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 ~0 days

Total

4

Last Release

84d ago

Major Versions

v1.2.0 → v2.0.02026-05-02

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9419148?v=4)[bohn.media](/maintainers/bohnmedia)[@bohnmedia](https://github.com/bohnmedia)

---

Top Contributors

[![dennisbohn](https://avatars.githubusercontent.com/u/87128053?v=4)](https://github.com/dennisbohn "dennisbohn (7 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bohnmedia-contao-flag-icons-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/bohnmedia-contao-flag-icons-bundle/health.svg)](https://phpackages.com/packages/bohnmedia-contao-flag-icons-bundle)
```

###  Alternatives

[contao/manager-bundle

Provides the Contao Managed Edition

181.3M77](/packages/contao-manager-bundle)[metamodels/core

MetaModels core

10156.4k68](/packages/metamodels-core)[codefog/contao-news_categories

News Categories bundle for Contao Open Source CMS

3189.0k6](/packages/codefog-contao-news-categories)[terminal42/contao-node

Node bundle for Contao Open Source CMS

3177.0k6](/packages/terminal42-contao-node)

PHPackages © 2026

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