All Projects → beyondcode → Laravel Favicon

beyondcode / Laravel Favicon

Licence: mit
Create dynamic favicons based on your environment settings.

Projects that are alternatives of or similar to Laravel Favicon

Pixelfed
Photo Sharing. For Everyone.
Stars: ✭ 3,237 (+1072.83%)
Mutual labels:  laravel
Alfred Laravel Docs
An ultra-fast Laravel docs search workflow for Alfred 3+.
Stars: ✭ 270 (-2.17%)
Mutual labels:  laravel
Blessing Skin Server
[OUTDATED, see @bs-community] A web application brings your custom skins back in offline Minecraft servers. (第三方 Minecraft 皮肤站)
Stars: ✭ 273 (-1.09%)
Mutual labels:  laravel
Free Pmo
Project management software for freelancers or agencies, built with Laravel 5.
Stars: ✭ 264 (-4.35%)
Mutual labels:  laravel
Laravel Eloquent Join
This package introduces the join magic for eloquent models and relations.
Stars: ✭ 270 (-2.17%)
Mutual labels:  laravel
Laravel Angular Cms
CMS built on Laravel, AngularJS and Material Design
Stars: ✭ 272 (-1.45%)
Mutual labels:  laravel
Eloquent Builder
Provides an advanced filter for Laravel or Lumen model.
Stars: ✭ 264 (-4.35%)
Mutual labels:  laravel
Laravel Chunk Upload
The basic implementation for chunk upload with multiple providers support like jQuery-file-upload, pupload, DropZone and resumable.js
Stars: ✭ 275 (-0.36%)
Mutual labels:  laravel
Laravel Gamp
📊 Laravel Google Analytics Measurement Protocol Package
Stars: ✭ 271 (-1.81%)
Mutual labels:  laravel
Manaphp
ManaPHP Framework: Swoole+FPM
Stars: ✭ 271 (-1.81%)
Mutual labels:  laravel
Blade Extensions
Laravel Blade extensions like $loop->odd/$loop->index in foreach, view blocks and partials, etc
Stars: ✭ 267 (-3.26%)
Mutual labels:  laravel
Nova Tabs
Laravel Nova Tabs Package
Stars: ✭ 265 (-3.99%)
Mutual labels:  laravel
Laravel Nova Lang
🌌 Language files for Laravel Nova translated into 40+ languages. Feel free to submit your language or update an existing one!
Stars: ✭ 275 (-0.36%)
Mutual labels:  laravel
Ray
Debug with Ray to fix problems faster
Stars: ✭ 263 (-4.71%)
Mutual labels:  laravel
Snipe Migrations
Blazing fast database migrations for Laravel tests.
Stars: ✭ 275 (-0.36%)
Mutual labels:  laravel
Cors
🔮Supported(Laravel/Lumen/PSR-15/Swoft/Slim/ThinkPHP) - PHP CORS (Cross-origin resource sharing) middleware.
Stars: ✭ 266 (-3.62%)
Mutual labels:  laravel
Laravel Aws Worker
Run Laravel (or Lumen) tasks and queue listeners inside of AWS Elastic Beanstalk workers
Stars: ✭ 272 (-1.45%)
Mutual labels:  laravel
Laravel Translator
An Eloquent translator for Laravel
Stars: ✭ 275 (-0.36%)
Mutual labels:  laravel
Laravel Recaptcha
Google ReCaptcha package for Laravel
Stars: ✭ 273 (-1.09%)
Mutual labels:  laravel
Tlint
Tighten linter for Laravel conventions
Stars: ✭ 274 (-0.72%)
Mutual labels:  laravel

Laravel Favicon

Latest Version on Packagist Build Status Quality Score Total Downloads

Create dynamic favicons based on your environment settings.

Laravel Package Development

https://phppackagedevelopment.com

If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming PHP Package Development video course.

Installation

You can install the package via composer:

composer require beyondcode/laravel-favicon

The service provider for this package will be automatically registered for you.

Usage

To make use of this package, make use of the favicon helper function that this package provides.

You can simply wrap the function around your favicon icon names, like this:

<link rel="icon" type="image/png" sizes="32x32" href="{{ favicon(asset('favicon-32x32.png')) }}">

<link rel="shortcut icon" href="{{ favicon('favicon.ico') }}" />

Customization

You can completely customize which environments you want to have enabled for the favicon generation, as well as the font and colors that will be used.

To modify the default values, publish the package configuration file using:

php artisan vendor:publish --provider='BeyondCode\LaravelFavicon\FaviconServiceProvider' --tag='config'

This will publish the config/favicon.php file.

This is what the default content looks like:

return [

    /*
     * The list of enabled environments for the dynamic favicon
     * generation. You can specify the text to display as well
     * as the font and background color for the text.
     *
     * If no background color is specified, the text will be
     * on a transparent background.
     */
    'enabled_environments' => [
        'local' => [
            'text' => 'DEV',
            'color' => '#000000',
            'background_color' => '#ffffff',
        ],
    ],

    /*
     * The dynamic favicon text padding to apply.
     */
    'padding' => [
        'x' => 2,
        'y' => 2,
    ],

    /*
     * The font file to use for the dynamic favicon generation.
     * The default value will use OpenSans Regular.
     */
    'font' => null,

    /*
    * Intervention Image supports "GD Library" and "Imagick" to process images
    * internally. You may choose one of them according to your PHP
    * configuration. By default PHP's "GD Library" implementation is used.
    *
    * If you want to convert ICO files, you need to use imagick.
    *
    * Supported: "gd", "imagick"
    *
    */
    'image_driver' => 'gd',

    /*
     * The prefix to use for the dynamic favicon URL.
     */
    'url_prefix' => 'laravel-favicon',

    /*
     * The favicon generator class to use. The default generator
     * makes use of the environment settings defined in this file.
     * But you can create your own favicon generator if you want.
     */
    'generator' => \BeyondCode\LaravelFavicon\Generators\EnvironmentGenerator::class,


];

Modify the settings to suit your needs.

Custom generator

The default favicon generator will write the text on the bottom-right corner of your favicon, in the desired color, font and background-color. If you want to generate a completely custom favicon, you can create your own FaviconGenerator implementation class and set it in the configuration file.

This is the interface that the generator should implement:

interface FaviconGenerator
{
    public function generate(string $icon): Response;

    public function shouldGenerateFavicon(): bool;
}

The generate method receives the icon url/filename and expects you to return an illuminate HTTP response.

The shouldGenerateFavicon method can be used to determine if a custom favicon should get generated.

FAQ

  • My ICO files are not working, why?

In order to modify ICO files, you need the Imagick PHP library installed and enabled in your config/favicon.php file.

  • Is there a performance impact when I'm using this package?

No - the default generator only modifies your favicon when the specified environment is enabled. This means, that production environments only see the static assets that you already have.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].