/Favicon

A PHP class for receiving favicons from the Google service and store them in a local database.

Primary LanguagePHP

Favicon PHP class

With the Favicon class you can get a favicon image by a given URL. Favicon receives the image from the Google service and stores it in a local database in form of a Base64 code.

Why not use the Google service directly?

If you want to get lots of favicon images it could take a long time to request the service for each URL.
Instead with this class the favicon stays cached in your database.

Define how often a favicon should get refreshed

With the $priority property you can specify how often a cached favicon image should get refreshed by the Google service.
By default it is set to 30 days.

How to use it

Favicon uses a MySQL database. In the src folder you'll find the exported .sql files.
Import them so you can use it.

Initialize a Favicon object

	<?php
		$myBlogFavicon = new Favicon("http://blog.lgk.io");
	?>
	<img src="<?php echo $myBlogFavicon->image; ?>" alt="Favicon">