PHPackages                             tsaiyihua/laravel-pagecache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. tsaiyihua/laravel-pagecache

ActiveLibrary[Caching](/categories/caching)

tsaiyihua/laravel-pagecache
===========================

Page Cache for Laravel

2.0.10(1mo ago)24.1k1MITPHPCI passing

Since Dec 11Pushed 3mo agoCompare

[ Source](https://github.com/tsaiyihua/laravel-pagecache)[ Packagist](https://packagist.org/packages/tsaiyihua/laravel-pagecache)[ RSS](/packages/tsaiyihua-laravel-pagecache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (24)Used By (0)

Laravel Page Cache
------------------

[](#laravel-page-cache)

This Package is mainly used as a cached content on the entire page.
If you had the low hit rate cache on your web page, this package will help you to solve this problem.

#### Basic Concept

[](#basic-concept)

- When the accessed web page does not have cached content, the program content is directly executed, and the execution program that generates the physical webpage file is thrown into the queue to execute.
- When the accessed web page has cached content, the cached content display is directly read.
- When the accessed webpage has cached content, but the file generation time exceeds the set expiration time, the cache content display is directly read first, and then the execution program that generates the physical webpage file is thrown into the queue for execution.

#### Laravel Support

[](#laravel-support)

VersionLaravel Version1.0.x5.6, 5.7, 5.81.1.x6.x2.x7.x, 8.x, 9.x, 10.x#### Install

[](#install)

- `composer require tsaiyihua/laravel-pagecache`
- `php artisan vendor:publish --tag=pagecache`
- Add disk to config/filesystems.php

```
        'pages' => [
            'driver' => 'local',
            'root' => env('PAGE_CACHE_DISK', storage_path('app/pages')),
        ],
```

- Add middleware to $routeMiddleware in app/Http/kernel.php

```
   'pageCache' => \TsaiYiHua\Cache\Http\Middleware\PageCache::class
```

- Create temporary folder, suppose that you use the default setting in Laravel

```
  cd {YOUR PROJECT FOLDER}
  mkdir storage/app/pages
  chmod 777 storage/app/pages
```

- And then add "pageCache" middleware to your route where you want to cache page

OK, It's done. Join it.

#### .env variable descriptions

[](#env-variable-descriptions)

```
    PAGE_CACHE_ENABLE=true
    PAGE_CACHE_ALIVE=1296000
    PAGE_CACHE_URL_PATTERN=/^(http.*)\/\/([^\/]+)[\/]?([^\?]+)?\??(.*)?/
    PAGE_CACHE_PARAMS=l,p
    PAGE_CACHE_DELAY=30
    PAGE_CACHE_OWNER=nobody
    PAGE_CACHE_GROUP=nobody
```

- PAGE\_CACHE\_ENABLE boolean, page cache will work while this value is true
- PAGE\_CACHE\_ALIVE timestamp, Page cache alive time, default is 15 days
- PAGE\_CACHE\_URL\_PATTERN regular expression, the default is common used, if you has the special rule, change this value.
- PAGE\_CACHE\_PARAMS the query string who want to be cached, separate by ','
- PAGE\_CACHE\_DISK The page cache file storage, if you use the default setting, don't set this variable in .env
- PAGE\_CACHE\_DELAY seconds, Create cache file after the page visited
- PAGE\_CACHE\_OWNER The page cache file owner. only used while manage the cache file
- PAGE\_CACHE\_GROUP The page cache file group. only used while manage the cache file

If you use the Cloud Storage, just ignore the PAGE\_CACHE\_OWNER and PAGE\_CACHE\_GROUP

#### APP\_ENV in .env

[](#app_env-in-env)

- While APP\_ENV is "production", the request parameter "noCache" will be set as false to avoid slow the online version.
- Base on the above reason
    - We suggest you have more than 2 servers, the APP\_ENV on online version can be set as "production", and one of the servers can be set other word except "production" to generator the cache file.
    - If you have only one server, the APP\_ENV can not be production.
    - The cache generator server must edit /etc/hosts, and add the domain ip to 127.0.0.1

#### Commands

[](#commands)

- `php artisan pagecache:clear`
    Clear all page cache, if there had the permission problem, just use sudo to execute.
- `php artisan pagecache:refresh {url}`
    Refresh the page cache by URL.
- `php artisan pagecache:info {url}`
    Get the page cache info by URL
- `php artisan pagecache:info stat {--date= : stat date}`
    If the {url} is state, it will show the stat info, the default date is today, you can use --date= to specify the date, format is Ymd.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance84

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~156 days

Recently: every ~183 days

Total

18

Last Release

56d ago

Major Versions

1.1.0 → 2.0.02020-03-13

1.1.0.x-dev → 2.0.12020-08-12

PHP version history (2 changes)1.0.0PHP &gt;=7.1.3

1.1.0PHP ^7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29859368?v=4)[tsaiyihua](/maintainers/tsaiyihua)[@tsaiyihua](https://github.com/tsaiyihua)

---

Top Contributors

[![tsaiyihua](https://avatars.githubusercontent.com/u/29859368?v=4)](https://github.com/tsaiyihua "tsaiyihua (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![google-labs-jules[bot]](https://avatars.githubusercontent.com/in/842251?v=4)](https://github.com/google-labs-jules[bot] "google-labs-jules[bot] (1 commits)")

---

Tags

laravelpagecachepagecache

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/tsaiyihua-laravel-pagecache/health.svg)

```
[![Health](https://phpackages.com/badges/tsaiyihua-laravel-pagecache/health.svg)](https://phpackages.com/packages/tsaiyihua-laravel-pagecache)
```

###  Alternatives

[swayok/alternative-laravel-cache

Replacements for Laravel's redis and file cache stores that properly implement tagging idea. Powered by cache pool implementations provided by http://www.php-cache.com/

202541.1k6](/packages/swayok-alternative-laravel-cache)[arifhp86/laravel-clear-expired-cache-file

Remove laravel expired cache file/folder

36128.7k](/packages/arifhp86-laravel-clear-expired-cache-file)[byerikas/cache-tags

Allows for Redis/Valkey cache flushing multiple tagged items by a single tag.

1413.9k](/packages/byerikas-cache-tags)[salehhashemi/laravel-configurable-cache

Configurable Laravel cache manager

2114.5k1](/packages/salehhashemi-laravel-configurable-cache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
