Download the PHP package germania-kg/favicons without Composer
On this page you can find all versions of the php package germania-kg/favicons. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download germania-kg/favicons
More information about germania-kg/favicons
Files in germania-kg/favicons
Package favicons
Short Description Get your Favicons in line with Twig and Slim
License
Informations about the package favicons
Germania Favicons
Get your favicons in line with Twig and Slim3 Framework
Installation with Composer
Setup Twig Template Loader
Add the favicons template path vendor/germania-kg/favicons/templates
(usually within Composer's package directory) to your Twig template loader:
Just in case the template directory is located elsewhere, you can use a mock instance of the Favicons class and use its getTemplatesPath
method:
Your website template
Inside your website template that renders your HTML head, include the Favicons Markup template. Twig will it look up in the template path defined in “Setup Twig Template Loader” section above:
The cache_bust variable is optional. However, this will output a bunch of link and meta elements similar to this:
Please note the two referenced files manifest.json
and browserconfig.xml
. Use an appropriate router like Slim framework to render these files according to your URL and theme color values, like shown in the “Routing” section below:
Routing browserconfig and manifest files
Simple Slim 3 example:
Advanced example: Instead of using the FaviconRouter instance above, you may want to define the routes yourself. This may be useful when you want to use your own templates:
Force Safari to update the Pinned Tab icons
It seems that Safari will ignore any new color after a pinned tab icon has been stored locally.
On OS X, force safari by emptying the Icon Folder in "~/Library/Safari/Template Icons"
. See Jonathan Hollin's article Managing Safari 9’s Pinned-tab Icon Cache. It basically goes like this:
Development
Unit tests
Either copy phpunit.xml.dist
to phpunit.xml
and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:
Todo: Make SlimRouterTest perfect
There is a SlimRouterTest class, but it does not more than creating a SlimRouter instance, using concrete Slim and Twig_Environment constructor parameters. For I do not know how to check if the Slim routing actually works, this test will be content if SlimRouter instantiation does not throw any error.