定制 empiricompany/maho-nocacheheader 二次开发

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

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

empiricompany/maho-nocacheheader

Composer 安装命令:

composer require empiricompany/maho-nocacheheader

包简介

Adds Cache-Control: no-store, no-cache, must-revalidate and Pragma: no-cache headers globally on all frontend pages, restoring OpenMage default behavior. Configurable via admin.

README 文档

README

Maho Commerce License PHP PHPStan Level

A Maho module that sends Cache-Control: no-store, no-cache, must-revalidate and Pragma: no-cache headers on all frontend pages. Configurable via admin.

When to use this module

Maho supports the browser's back-forward cache (bfcache) natively via the pageshow JavaScript event (see PR #991). This is the recommended approach: pages are served from bfcache for instant navigation, and the pageshow handler refreshes dynamic content (cart sidebar, checkout state) when the page is restored.

This module is intended for custom or legacy themes that do not implement the pageshow event (or equivalent client-side logic) and need to prevent stale dynamic content by disabling bfcache on the server side via Cache-Control: no-store.

Requirements

  • PHP >= 8.3
  • Maho Commerce

Installation

composer require empiricompany/maho-nocacheheader

Clear the cache after installation:

./maho cache:flush

Configuration

Go to System → Configuration → Web → Cache-Control Header and set Add Cache-Control: no-store, no-cache, must-revalidate and Pragma: no-cache headers to Yes.

The setting applies to frontend only — admin panel is not affected.

Development

This module ships with the standard Maho CI gates:

  • PHPStan (level 8) — vendor/bin/phpstan analyze
  • Rector (dry-run) — vendor/bin/rector -c .rector.php --dry-run
  • PHP CS Fixer (dry-run) — vendor/bin/php-cs-fixer fix --dry-run
  • PHP / XML syntax checks — automatic on CI

Run composer install and you can execute any of the above locally before pushing.

License

OSL-3.0 / AFL-3.0

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: OSL-3.0
  • 更新时间: 2026-06-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固