sablesoft / yii2-flags
Flags asset for yii2 application
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.2
- bower-asset/flag-icon-css: *
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2025-03-07 00:58:34 UTC
README
Yii2 Asset Bundle for country flags rendering.
Installation
The preferred way to install is through composer.
Either run
composer require sablesoft/yii2-flags
or add
"sablesoft/yii2-flags": "*",
to the require section of your composer.json.
Usage
For using the flags inline with text add the classes .flag-icon
and
.flag-icon-xx
(where xx
is the
ISO 3166-1-alpha-2 code
of a country) to an empty <span>
. If you want to have a squared version flag
then add the class flag-icon-squared
as well. Example:
<span class="flag-icon flag-icon-gr"></span> <span class="flag-icon flag-icon-gr flag-icon-squared"></span>
You could also apply this to any element, but in that case you'll have to use the
flag-icon-background
instead of flag-icon
and you're set. This will add the
correct background with the following CSS properties:
background-size: contain; background-position: 50%; background-repeat: no-repeat;
Which means that the flag is just going to appear in the middle of an element, so
you will have to set manually the correct size of 4 by 3 ratio or if it's squared
add also the flag-icon-squared
class.