Download the PHP package rizhou/page-cache without Composer

On this page you can find all versions of the php package rizhou/page-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package page-cache

packages-page-cache

介绍

Laravel 页面静态化缓存

安裝教程

composer require rizhou/page-cache

导出配置文件

php artisan vendor:publish --provider="Rizhou\PageCache\LaravelServiceProvider"

配置文件参数说明

enable 是否启用
except 过滤的路由,如:product/*
cache_dir 保存的路径

使用方法

打开app/Http/Kernel.php 向web中间件组添加一项

protected $middlewareGroups = [
    'web' => [
        \Rizhou\PageCache\Middleware\PageCacheResponse::class,
        ...
    ],
];

如果你只想选择性的去缓存特定的请求,则可以向routeMiddleware添加路由别名映射

protected $routeMiddleware = [
    'page-cache' => \Rizhou\PageCache\Middleware\PageCacheResponse::class,
    ...
];

清除页面缓存

php artisan page-cache:clear

最好将命令加入到任务调度中,这样就可以定时清除页面缓存

自定义缓存条件

1.创建中间件

php artisan make:middleware CacheResponse

2.继承原中间件,并重写以下方法

   <?php

   namespace App\Http\Middleware;

   use Illuminate\Http\Request\Request;
   use Illuminate\Http\Request\Response;
   use Rizhou\PageCache\Middleware\CacheResponse as BaseCacheResponse;

   class CacheResponse extends BaseCacheResponse
   {
       protected function needIfCache(Request $request, Response $response)
       {
           //通过自定义的条件只要该方法返回false 则不会进行缓存
           //如:
           if ($request->path() == '/product') {
               return false;
           }

           return parent::needIfCache($request, $response);
       }
   }

All versions of page-cache with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rizhou/page-cache contains the following files

Loading the files please wait ....