承接 oskar-koli/kirby-litespeed 相关项目开发

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

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

oskar-koli/kirby-litespeed

Composer 安装命令:

composer require oskar-koli/kirby-litespeed

包简介

Litespeed cache plugin for Kirby CMS

README 文档

README

Packagist Version

A Kirby CMS plugin which adds support for caching pages using Litespeed's LSCache.

Kirby's built in caching still requires Kirby to boot for the cached pages to be returned, which results in even cached requests usually taking at least 150ms on shared hosting. Using this plugin Kirby doesn't have to be booted when a cached page is hit, resulting in 70ms or faster response times.

Installation & Configuration

Requirements

  • Kirby CMS ^5
  • Litespeed server (The site will still work without a Litespeed server, but then this plugin does nothing)

Installation

composer require oskar-koli/kirby-litespeed

Configuration

// site/config/config.php
'cache' => [
    'pages' => [
        'type' => 'litespeed',
        'active' => true,

        // Optional:

        // Controls if page should be cached
        'ignore' => fn ($page) => $page->title()->value() === 'Do not cache me',

        // Controls how long Litespeed caches the page (in seconds)
        // The default duration is 2 days (172800 seconds)
        'duration' => fn ($page) => $page->slug() == 'slug' ? 172800 : 600
    ]
]

Note: The Litespeed cache can only be used for pages and will not work as the driver for any other kind of cache.

Caching & Purging Logic

LSCache's public cache is the only one used, the private cache is not supported.

A page is cached following the same rules as described in Kirby's documentation.

The cache is purged when

  • Kirby requests a purge, e.g. when any edits are made in the Panel (this causes a full purge)
  • When Litespeed decides to purge a cache, e.g. when the max-age has been reached.

.htaccess Configuration

The plugin does not modify the .htaccess automatically. You need to enable Litespeed caching manually by for example adding the following configuration:

<IfModule LiteSpeed>
    RewriteEngine on
    CacheLookup on
    RewriteRule .* - [E=Cache-Control:no-autoflush]
    
    # Ignore some common query parameters
    CacheKeyModify -qs:fbclid
    CacheKeyModify -qs:gclid
    CacheKeyModify -qs:utm*
    CacheKeyModify -qs:_ga
</IfModule>

CLI Cache Purging

You can manually clear the cache using Kirby CLI:

kirby clear:cache pages

This works by making an HTTP request to a route on the website which triggers the Litespeed server to purge the cache.

For CLI purging to work, you need to define a purge token in your config.php:

// Token used to authenticate the REST call which purges the cache
'oskar-koli.kirby-litespeed.purge-token' => 'your-secure-token-here'

You can for example generate the token by running openssl rand -hex 32.

Additionally, the plugin needs to know the URL of your site. You have three options:

Option 1: Plugin specific option

'oskar-koli.kirby-litespeed.site-url' => 'https://example.com'

Option 2: Environment variable

LITESPEED_SITE_URL="https://example.com" kirby clear:cache pages

Option 3: Kirby's URL option

If none of these are set, the plugin will fall back to site()->url().
For this to work in CLI, the url option has to be set:

'url' => 'https://example.com'

Is the plugin production ready?

The plugin is in use in production on a couple smaller websites and everything is working smoothly. That being said, there might still be some edge cases that which might cause issues on more complex websites. Please submit a bug report if you face any issues!

oskar-koli/kirby-litespeed 适用场景与选型建议

oskar-koli/kirby-litespeed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 129 次下载、GitHub Stars 达 4, 最近一次更新时间为 2025 年 09 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 oskar-koli/kirby-litespeed 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 oskar-koli/kirby-litespeed 我们能提供哪些服务?
定制开发 / 二次开发

基于 oskar-koli/kirby-litespeed 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-19