Download the PHP package jerrybendy/get-favicon without Composer

On this page you can find all versions of the php package jerrybendy/get-favicon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package get-favicon

Jerrybendy/get-favicon

获取网站的Favicon图标并显示在你的网页上.

Latest Stable Version Total Downloads License

使用方法

1.添加jerrybendy/get-favicon到你的composer.json文件中

在命令行中执行:

2.使用以下方式获取网站图标

示例代码参见 demo/basic-usage.php

其它用法

默认图标

默认图标用于在线获取图标失败时返回一个指定的图标文件作为代替。如果没有指定默认图标系统将会在获取失败时返回一个JSON字符串。

文件映射

文件映射主要用于针对某些网站特殊处理(例如打不开的网站),如果网址能够匹配某个预设的规则,就返回指定的图标资源。

文件映射setFileMap函数接收一个数组作为参数,数组的键必须是正则表达式,值则可以对应到一个本地文件或网络文件的路径,你需要保证这个文件是可以正常读取的。

多个匹配规则会按顺序从上到下依次尝试匹配,并在第一次匹配成功后返回。

在上面的例子中,如果输入的网址匹配了/www\.google\.com/i规则,将会返回百度的图标;如果匹配了/www\.facebook\.com/i规则将会读取本地已经存在的facebook.png文件。

使用缓存

formatUrl方法返回一个格式化后的完整的URL字符串, 可以被用作缓存的键名. Favicon类中没有内置任何缓存的实现, 所以需要自己根据实际情况选择不同的缓存方式.

getFavicon也可以接收可选的第二个参数,默认值是FALSE表示直接输出获取到的图标到浏览器. 设置成TRUE可以强制返回二进制数据而不显示,以方便在外部做缓存之类的操作.

demo/use-cache.php中的示例代码演示了如何添加和使用缓存.

调试模式

打开调试模式将会在系统的错误日志中输出一些信息,可以用来查看程序的运行时间、资源占用以及读取图标的来源等信息。因为输出是通过PHP内置的error_log函数实现的,所以可能需要通过PHP系统的错误日志去查看,或者php_error.log中。如果是用命令行php -S参数启动可以直接在控制台中看到日志内容。

打开调试模式:

LICENSE

The MIT License (MIT)

Copyright (c) 2015 Jerry Bendy

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


All versions of get-favicon with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jerrybendy/get-favicon contains the following files

Loading the files please wait ....