Installs: 1 397

Dependents: 7

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 2

Open Issues: 1


3.1.1 2019-08-02 23:45 UTC

This package is auto-updated.

Last update: 2023-03-07 22:44:17 UTC


Based in: (For file cache redirections)

To activate the Cache System


// config/app.php

'providers' => [

This package also comes with a facade.

// config/app.php

'aliases' => [
   'ResponseCache' => Modules\Ihelpers\Other\ImResponseCache::class,

You can publish the config file with:

php artisan vendor:publish --provider="Modules\Ihelpers\Other\ImResponseCache\ImResponseCacheServiceProvider"

Command available to clear cache

php artisan pagecache:clear

URL rewriting

In order to serve the static files directly once they've been cached, you need to properly configure your web server to check for those static files.

  • For nginx:

    Update your location block's try_files directive to include a check in the page-cache directory:

    location / {
        try_files $uri $uri/ /page-cache/$uri.html /index.php?$query_string;
  • For apache:

    Open public/.htaccess and add the following before the block labeled Handle Front Controller:

    # Serve Cached Page If Available...
    RewriteCond %{REQUEST_URI} ^/?$
    RewriteCond %{DOCUMENT_ROOT}/page-cache/pc__index__pc.html -f
    RewriteRule .? page-cache/pc__index__pc.html [L]
    RewriteCond %{DOCUMENT_ROOT}/page-cache%{REQUEST_URI}%{QUERY_STRING}.html -f
    RewriteRule . page-cache%{REQUEST_URI}.html [L]

CUSTOM include and relationship features:

You can set custom includes and relationships in any entity from any module as follows:

  • In Modules\Imodule\Config\config.php:

            'path'=>'Modules\Iothermodule\Transformers\OtherEntityTransformer', //this is the transformer path
            'multiple'=>false, //if the relationship is one-to-many, multiple must be set to true
    'relations' =>[
        'otherEntity' => function () {
          return $this->hasOne(
            \Modules\Iothermodule\Entities\OtherEntity::class, 'model_id');
  • In Modules\Imodule\Entities\Entity.php:

    You must be use the trait for use the custom relations as follows:

    use Modules\Ihelpers\Traits\Relationable;
    class Entity extends Model{
      use Relationable;
  • In Modules\Imodule\Transformers\EntityTransformer.php:

    You must be use the trait for use the custom includes as follows:

      use Modules\Ihelpers\Traits\Transformeable;
      class EntityTransformer extends Resource{
        use Transformeable;