makkinga/laravel-flags

A helper for placing SVG flags in your Laravel project

0.0.6 2020-12-07 12:27 UTC

This package is auto-updated.

Last update: 2024-05-07 21:07:03 UTC


README

A helper for placing SVG flags in your Laravel project

GitHub tag (latest SemVer) GitHub tag (latest SemVer) Total Downloads License: MIT

Buy Me A Coffee

Installation

Install using composer

composer require makkinga/laravel-flags

Usage

Blade

Use this helper to place an SVG in a Blade view.

{!! flag()->country('nl') !!} 

The country() method expects an alpa-2 or alpha-3 ISO 3166-1 country code. See this page for a complete list of all codes.

Config

If your locales differ from the ISO codes (e.g.: you use en instead of gb), you can optionally publish the cofig to alias the country codes.

php artisan vendor:publish --provider="Makkinga\Flags\ServiceProvider" --tag="config"

flags.php

<?php

return [
    'aliases' = [
        //
    ]
];

To alias the codes add your locales to the locales array where the key is your locale and the value is the ISO country code:

<?php

return [
    'aliases' = [
        'en' => 'gb',
    ]
];

Licence (MIT)

MIT License

Copyright (c) 2020 Gydo Makkinga gydo@makkinga.online

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.