PHPackages                             hieu-le/favicon - 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. hieu-le/favicon

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hieu-le/favicon
===============

A configurable PHP solution to auto generate favicons and HTML meta tags from a original PNG file.

1.1.0(11y ago)124986[1 issues](https://github.com/letrunghieu/favicon/issues)1MITPHPPHP &gt;=5.3.3

Since Mar 18Pushed 11y agoCompare

[ Source](https://github.com/letrunghieu/favicon)[ Packagist](https://packagist.org/packages/hieu-le/favicon)[ RSS](/packages/hieu-le-favicon/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (1)

favicon
=======

[](#favicon)

[![Build Status](https://camo.githubusercontent.com/281b3e5aa2e72c61c68364bdf74f7c67019784220da5b6de5b4bd0456b44a266/68747470733a2f2f7472617669732d63692e6f72672f6c657472756e67686965752f66617669636f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/letrunghieu/favicon) [![Latest Stable Version](https://camo.githubusercontent.com/780257c993be04115e0329b0c535387e2e51c0f0be10e39208a2a7127284bc77/68747470733a2f2f706f7365722e707567782e6f72672f686965752d6c652f66617669636f6e2f762f737461626c652e737667)](https://packagist.org/packages/hieu-le/favicon) [![Total Downloads](https://camo.githubusercontent.com/ccb97d82182e844c51b2b9472343bbc2263eb4c3fb37e4281df5cbf543c41330/68747470733a2f2f706f7365722e707567782e6f72672f686965752d6c652f66617669636f6e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/hieu-le/favicon) [![Latest Unstable Version](https://camo.githubusercontent.com/9e9b633880df79c5e23caa36f9a7605bfc23eaf26c34a5a023fdcaf7531f8fde/68747470733a2f2f706f7365722e707567782e6f72672f686965752d6c652f66617669636f6e2f762f756e737461626c652e737667)](https://packagist.org/packages/hieu-le/favicon) [![License](https://camo.githubusercontent.com/6ef94eace6d4d7a57052f15cf788e1ddba304540c01d81e4bab9d6afd31bdaa7/68747470733a2f2f706f7365722e707567782e6f72672f686965752d6c652f66617669636f6e2f6c6963656e73652e737667)](https://packagist.org/packages/hieu-le/favicon)

A configurable PHP solution to auto generate favicons and HTML tags from a original PNG file.

What does this package do?
--------------------------

[](#what-does-this-package-do)

In short, it will help you display correct favicon for your website with just **one** original PNG image.

In more details, it supports:

- create **one** ICO file and **many** PNG files with many favicon sizes from just **one** original PNG image as well as a `manifest.json` file for Android devices. Both input file path and output folder (which contains images and json files) are configurable via a command line interface.
- Generate suitable `meta` and `link` tags for desktop web browsers as well as mobile touch devices to properly display favicon.

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

[](#installation)

We need [PHP imagick extension](http://php.net/manual/en/book.imagick.php) or [PHP GD extension](http://php.net/manual/en/book.image.php) for generating images. By default, the Imagick extension is loaded, if you cannot install it, you can switch to using GD via command line option if available.

You will need (Composer)\[\] to use this package. After install Composer, add this dependency into your `composer.json` file.

```
"hieu-le/favicon" : "~1.0"

```

Run `composer update` and start using.

Generate images
---------------

[](#generate-images)

To use the command line to to generate favicon files:

```
$ vendor/bin/favicon generate [--ico-64] [--ico-48] [--no-old-apple] [--no-android] [--no-ms] [--app-name="..."] input [output]

```

Arguments:

- `input`: path to the input image files, which is required
- `output`: path to the folder which contains output files. If this folder does not exist, the package will try to create it. This argument is optional, default value is current folder.

Options:

- `--use-gd`: use GD extension instead of Imagick extension The Imagick ext is used by default. GD library is used if cannot load Imagick ext.
- `--ico-64`: include the 64x64 image inside the output ICO file (which contains only 16x16 and 32x32 images by default)
- `--ico-48`: include the 48x48 image inside the output ICO file (which contains only 16x16 and 32x32 images by default). Both `--ico-48` and `--ico-64` options make the output icon file larger a lot.
- `--no-old-apple`: exclude pngs files that used by old Apple touch devices
- `--no-android`: exclude `manifest.json` files and PNG files for Android devices
- `--no-ms`: exclude images for Windows tile
- `--app-name="..."` set the application name in the `manifest.json` file. Default is an empty string.

Output HTML tags
----------------

[](#output-html-tags)

Call the `favicon` function inside your HTML template as follow:

```
echo favicon($option = FAVICON_ENABLE_ALL, array $msOptions = array())
```

The `$option` argument is a bitmask with following bit:

- `FAVICON_NO_OLD_APPLE` : do not include old apple touch `link` tags
- `FAVICON_NO_ANDROID` : do not include Android `manifest.xml` link tag
- `FAVICON_NO_MS` : do not include Windows and IE `meta` tags

The default value is `FAVICON_ENABLE_ALL` turns of all these three bit and include everything in the final output. Here are some examples:

- To exclude old apple touch `link` tags: `FAVICON_NO_OLD_APPLE`
- To exclude Android manifest file and IE `meta` tags: `FAVICON_NO_ANDROID | FAVICON_NO_MS`
- To exclude all these additional tags: `FAVICON_NO_OLD_APPLE | FAVICON_NO_ANDROID | FAVICON_NO_MS`

The `$msOptions` argument is an array contains information for Windows and IE. It can has these fields:

- `tile_color`: the background of live tile when this site is pinned, default is white (`#ffffff`)
- `browser_config_file`: the path to browser config XML file if you have it. By default, it is set to an empty string to prevent IE from auto looking `browserconfig.xml` file
- `application_name`: the default application name displayed when user pinned this site

The result of

```
echo favicon(FAVICON_ENABLE_ALL, array(
  'tile_color' => '#F0F0F0',
  'browser_config_file' => 'IEConfig.xml',
  'application_name' => 'Hieu Le Favicon'
));
```

is a HTML segment link this:

```

```

License
-------

[](#license)

The package is released under MIT license. See the [`LICENSE`](https://github.com/letrunghieu/favicon/blob/master/LICENSE) file for more detail.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

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

2

Last Release

4072d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98ce9136dff54b74ddb9afe69ae5c9c0cf573b00603e80ad9ee332f24f0b1342?d=identicon)[letrunghieu](/maintainers/letrunghieu)

---

Top Contributors

[![letrunghieu](https://avatars.githubusercontent.com/u/1145335?v=4)](https://github.com/letrunghieu "letrunghieu (22 commits)")

---

Tags

pngfavicongenerateico

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hieu-le-favicon/health.svg)

```
[![Health](https://phpackages.com/badges/hieu-le-favicon/health.svg)](https://phpackages.com/packages/hieu-le-favicon)
```

###  Alternatives

[sqids/sqids

Generate short YouTube-looking IDs from numbers

5781.4M33](/packages/sqids-sqids)[ashallendesign/favicon-fetcher

A Laravel package for fetching website's favicons.

190272.4k3](/packages/ashallendesign-favicon-fetcher)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[scrumble-nl/laravel-model-ts-type

This package makes it possible to generate TypeScript types based on your models

6984.5k](/packages/scrumble-nl-laravel-model-ts-type)[dirape/token

Unique Token Generator For Laravel

28277.4k2](/packages/dirape-token)[kevinlebrun/slug.php

Slug helpers

4451.4k1](/packages/kevinlebrun-slugphp)

PHPackages © 2026

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