xanweb/c5-web-link
最新稳定版本:v2.0.2
Composer 安装命令:
composer require xanweb/c5-web-link
包简介
Manage HTML head links to improve page load performance
关键字:
README 文档
README
Manage HTML head links to improve page load performance
Installation
Include library to your composer.json
composer require xanweb/c5-web-link
Add the service provider and middleware to application/config/app.php
return [ 'providers' => [ 'xw_web_link' => '\Xanweb\C5\WebLink\ServiceProvider' ] ];
Make sure you are loading vendor autoload application/bootstrap/autoload.php
<?php defined('C5_EXECUTE') or die('Access Denied.'); /* * ---------------------------------------------------------------------------- * Load all composer autoload items. * ---------------------------------------------------------------------------- */ // If the checker class is already provided, likely we have been included in a separate composer project if (!class_exists(\DoctrineXml\Checker::class)) { // Otherwise, lets try to load composer ourselves if (!@include(DIR_BASE_CORE . '/' . DIRNAME_VENDOR . '/autoload.php')) { echo 'Third party libraries not installed. Make sure that composer has required libraries in the concrete/ directory.'; die(1); } } if (file_exists(DIR_BASE . '/' . DIRNAME_VENDOR . '/autoload.php')) { include_once (DIR_BASE . '/' . DIRNAME_VENDOR . '/autoload.php'); }
Usage
use \Fig\Link\Link; use \Fig\Link\Relations; // Example with Font Preload $link = (new Link(Relations::REL_PRELOAD, '/path/to/font.woff2')) ->withAttribute('as', 'font') ->withAttribute('type', 'font/woff2') ->withAttribute('crossorigin', 'anonymous'); app('web/link')->queueLink($link);
统计信息
- 总下载量: 220
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-19