vincepare/favicon-downloader
Composer 安装命令:
composer require vincepare/favicon-downloader
包简介
Find & download favicons
README 文档
README
FaviconDownloader can find favicon URL (and download it) from a web page URL. This PHP class handles multiple favicons flavors, including some edge cases like relative URL or embed favicons :
- Absolute URL :
<link rel="shortcut icon" href="http://www.domain.com/images/fav.ico" /> - Absolute URL with relative scheme :
<link rel="shortcut icon" href="//www.domain.com/images/fav.ico" /> - Absolute path :
<link rel="shortcut icon" href="/images/fav.ico" /> - Relative URL :
<link rel="shortcut icon" href="../images/fav.ico" /> - Embed base64-encoded favicon :
<link rel="icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAE ... /wAA//8AAA==" />
Install
The easiest way to install FaviconDownloader is to use Composer from the command line :
composer require vincepare/favicon-downloader
Otherwise, just download FaviconDownloader.php and require it manually. Tested on PHP 5.3, 5.4, 5.5 & 5.6.
Example
require 'FaviconDownloader.php'; use Vincepare\FaviconDownloader\FaviconDownloader; // Find & download favicon $favicon = new FaviconDownloader('http://stackoverflow.com/questions/19503326/bug-with-chrome-tabs-create-in-a-loop'); if (!$favicon->icoExists) { echo "No favicon for ".$favicon->url; die(1); } echo "Favicon found : ".$favicon->icoUrl."\n"; // Saving favicon to file $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'favicon-'.time().'.'.$favicon->icoType; file_put_contents($filename, $favicon->icoData); echo "Saved to ".$filename."\n\n"; echo "Details :\n"; $favicon->debug();
统计信息
- 总下载量: 432
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-06-22