定制 rabbit-loader/php-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

rabbit-loader/php-sdk

最新稳定版本:v1.0.16

Composer 安装命令:

composer require rabbit-loader/php-sdk

包简介

PHP SDK for optimizing websites with RabbitLoader

README 文档

README

RabbitLoader PHP SDK can be used to speed up any website that is built using core PHP or frameworks.

Highlights

  • 🚀 Boost PageSpeed Insights Score for all pages of the custom developed website
  • 🏗️ Automatically reduce image size by ~40% by converting to NextGen AVIF and WebP formats
  • ➰ Lazy load below-the-fold images and YouTube videos
  • 📱 Reduce CSS size by 98% automatically by generating critical-css for fastest rendering of the webpage
  • ✨ Improve all Core Web Vitals metrics (lower FCP, FID, and CLS)
  • ⚡️ Higher rankings on Google Search and better conversions due to page speed optimization and healthy Core Web Vitals metrics
  • 🌐 Cache and serve static assets (CSS/JS/Images) via inbuilt premium CDN
  • ♾️ HTTP/3 Full request and response multiplexing of static assets
  • 🗜️ Use Brotli compression for static assets transfer and loading

Installation

composer require rabbit-loader/php-sdk

Example

Example use, assuming index.php is the file that handles all traffic for the website.

Public page example

#load vendor/autoload.php

#integrate RabbitLoader
$licenseKey = 'YOUR_LICENSE_KEY'; //get your license key from environment variable
$storageDir = '/cache-disk/rabbitloader'; //storage location where cached files will be stored
$rlSDK = new RabbitLoader\SDK\RabbitLoader($licenseKey, $storageDir);
$rlSDK->process();

#remaining code of the website goes after this ...
echo "<h1>Hello World!</h1>"

Admin page example

When a content is modified from admin panel, this can be called to make the cache stale.

#admin.php

$urlModified = 'https://mywebsite.com/modified-page-slug/';
$rlSDK->onContentChange($urlModified);

#if home page needs to be purged too, then-
$rlSDK->onContentChange('https://mywebsite.com/');

Skipping some pages from caching and optimization

//skip caching if path starts with admin
$rlSDK->skipForPaths(['/admin*']);

//skip caching if a cookie is found with name cookie1 
$rlSDK->skipForCookies(['cookie1']);

//all the above options should come before the process() call
$rlSDK->process();

More Samples and License Key

A license key is required to run the SDK. This guide has more code samples and explains how to get the license key.

Support

Contact RabbitLoader team here.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2023-07-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固