承接 nzm/amp-cache-url 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nzm/amp-cache-url

最新稳定版本:1.0.1

Composer 安装命令:

composer require nzm/amp-cache-url

包简介

Composer package for generating AMP Cache URLs

README 文档

README

This PHP library provides a class called Generator that allows you to generate cache URLs for the AMP Cache. It is inspired by the @ampproject/toolbox-cache-url library in Node.js.

Installation

You can install this library using Composer. Run the following command:

composer require nzm/amp-cache-url

Usage

Here's an example of how to use the Generator class:

use Nzm\AmpCacheUrl\Generator;
use Nzm\AmpCacheUrl\ServingMode;

$generator = new Generator();
$domainSuffix = 'cdn.ampproject.org';
$url = 'https://example.com/amp/page.html';
$servingMode = ServingMode::Content;

$cacheUrl = $generator->Generate($domainSuffix, $url, $servingMode);

echo $cacheUrl;

This will output the cache URL for the provided URL and serving mode.

URL Generation

The Generate method in the Generator class takes the domain suffix, the URL, and an optional serving mode as parameters and returns the cache URL for the given input. It handles the necessary encoding and formatting of the URL.

Credits

This library is an implementation of the @ampproject/toolbox-cache-url library in Node.js. You can find the original Node.js library here.

License

This library is released under the MIT License.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-23