PHPackages                             hryvinskyi/magento2-page-layout-manager - 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. hryvinskyi/magento2-page-layout-manager

ActiveMagento2-module[Caching](/categories/caching)

hryvinskyi/magento2-page-layout-manager
=======================================

Adobe Commerce / Magento 2 Performance optimisation module for avoid entity specific page cache bloat

1.0.6(3mo ago)391MITPHPPHP &gt;=8.1

Since Sep 15Pushed 3mo agoCompare

[ Source](https://github.com/hryvinskyi/magento2-page-layout-manager)[ Packagist](https://packagist.org/packages/hryvinskyi/magento2-page-layout-manager)[ RSS](/packages/hryvinskyi-magento2-page-layout-manager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (8)Used By (0)

Adobe Commerce / Magento 2 Performance optimisation module for avoid entity specific page cache bloat
=====================================================================================================

[](#adobe-commerce--magento-2-performance-optimisation-module-for-avoid-entity-specific-page-cache-bloat)

This module provides configurable control over entity-specific page layout caching to prevent cache bloat in big stores.

Problem
-------

[](#problem)

In Adobe Commerce / Magento 2, when `addPageLayoutHandles()` is called with `entitySpecific = true`, it creates individual cache entries for each entity id or sku (catalog\_category\_view\_id\_123.xml or catalog\_product\_view\_id\_123.xml or catalog\_product\_view\_sku\_test.xml). In large store setups, this can lead to massive cache growth.

Solution
--------

[](#solution)

This module provides two possible configuration:

1. Allow Entity-Specific Layout Handles (default: false) - when disabled, blocks all entity-specific layouts like `*_id_*.xml`
2. Use Only Specific Validators (default: true) - When enabled, the entity-specific layout will be added only for validated requests

### Composer Installation

[](#composer-installation)

```
composer require hryvinskyi/magento2-page-layout-manager
php bin/magento module:enable Hryvinskyi_PageLayoutManager
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
```

### Manual Installation

[](#manual-installation)

1. Create directory `app/code/Hryvinskyi/PageLayoutManager`
2. Download and extract module contents to this directory
3. Enable the module:

```
bin/magento module:enable Hryvinskyi_PageLayoutManager
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
```

Features
--------

[](#features)

### CMS Page Layout Management

[](#cms-page-layout-management)

The module automatically disables entity-specific page layouts for CMS pages to prevent cache bloat:

- **Admin Panel**: The page layout field is disabled (grayed out) in the CMS page edit form with an informative message
- **Frontend**: Entity-specific page layouts are not applied to CMS pages - only global/theme-level layouts are used
- **Cache Optimization**: Prevents creation of separate cache entries for each CMS page layout variation

This ensures consistent layout handling across all CMS pages while significantly reducing cache storage requirements.

Usage
-----

[](#usage)

### Creating Custom Validators

[](#creating-custom-validators)

#### 1. Implement the Validator Interface

[](#1-implement-the-validator-interface)

```
