2017-25 © Pedro Peláez
 

library favicon

PHP Library used to discover favicon from given URL

image

arthurhoaro/favicon

PHP Library used to discover favicon from given URL

  • Sunday, April 23, 2017
  • by ArthurHoaro
  • Repository
  • 2 Watchers
  • 21 Stars
  • 6,135 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 7 Versions
  • 33 % Grown

The README.md

A library to determine a site's favicon

This library is based on Chris Shiflett work., (*1)

Here are the changes you can see in this version:, (*2)

  • Cover more use case to find favicons
  • Composer support
  • Various technical changes and improvements
  • Unit tests

Requirements

Composer

Use Composer by adding the following lines in your composer.json:, (*3)

"require": {
    "arthurhoaro/favicon": "~2.0"
}

Basic Usage

require_once('vendor/autoload.php');

$favicon = new \Favicon\Favicon();

echo $favicon->get('http://hoa.ro');
// Displays: http://hoa.ro/themes/hoaro/img/favicon.png
var_dump($favicon->get('http://nofavicon.tld', FaviconDLType::HOTLINK_URL));
// Returns false

You can avoid hotlinking by downloading the favicons:, (*4)

$favicon = new \Favicon\Favicon();

// return the generated filename inside the cache folder
$favicon->get('http://hoa.ro', FaviconDLType::DL_FILE_PATH);
// return false
$favicon->get('http://nofavicon.tld');

Or directly get the raw image as a binary string:, (*5)

$favicon = new \Favicon\Favicon();

// return the binary string of the downloaded favicon
$favicon->get('http://hoa.ro', FaviconDLType::RAW_IMAGE);
// return false
$favicon->get('http://nofavicon.tld');

Note: DL_FILE_PATH and RAW_IMAGE require the cache to be enabled., (*6)

Configure

You can setup cache settings:, (*7)

$favicon = new Favicon();
$settings = array(
    // Cache directory
    'dir' => '/tmp/',
    // Cache timeout in seconds
    'timeout' => 86400,
    // Default image when no favicon is found
    'defaultico' => 'img/fav.ico'
);
$favicon->cache($settings);

The Versions

23/04 2017

dev-master

9999999-dev https://github.com/ArthurHoaro/favicon

PHP Library used to discover favicon from given URL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires

icon favicon finder

23/04 2017

v1.2.1

1.2.1.0 https://github.com/ArthurHoaro/favicon

PHP Library used to discover favicon from given URL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires

icon favicon finder

23/04 2017

dev-travis

dev-travis https://github.com/ArthurHoaro/favicon

PHP Library used to discover favicon from given URL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires

icon favicon finder

17/04 2017

v1.2.0

1.2.0.0 https://github.com/ArthurHoaro/favicon

PHP Library used to discover favicon from given URL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires

icon favicon finder

17/10 2014

v1.1.1

1.1.1.0 https://github.com/ArthurHoaro/favicon

PHP Library used to discover favicon from given URL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

icon favicon finder

15/10 2014

v1.1.0

1.1.0.0 https://github.com/ArthurHoaro/favicon

PHP Library used to discover favicon from given URL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

icon favicon finder

14/10 2014

v1.0.0

1.0.0.0 https://github.com/ArthurHoaro/favicon

PHP Library used to discover favicon from given URL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

icon favicon finder