PHPackages                             blackbird/module-eav-optimize - 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. blackbird/module-eav-optimize

ActiveMagento2-module

blackbird/module-eav-optimize
=============================

Improve EAV attribute option performance

1.0.2(1y ago)114.8k↓40.3%3[1 issues](https://github.com/blackbird-agency/magento-eav-optimize/issues)MITPHP

Since Dec 16Pushed 1y ago2 watchersCompare

[ Source](https://github.com/blackbird-agency/magento-eav-optimize)[ Packagist](https://packagist.org/packages/blackbird/module-eav-optimize)[ RSS](/packages/blackbird-module-eav-optimize/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

EavOptimize - Magento 2 Plugin
==============================

[](#eavoptimize---magento-2-plugin)

Description
-----------

[](#description)

The **EavOptimize** plugin provides a solution to optimize the performance of fetching attribute options in Magento 2. It introduces **memoization** and **caching** for EAV (Entity-Attribute-Value) attribute option values, which can improve store performance by reducing redundant database calls.

Additionally, this module forces the default value of `cache_user_defined_attributes` system configuration to `1`, ensuring that custom attributes are cached by default for better efficiency. You can still disable this config in adminhtml.

See existing Magento issue: [magento/magento2#36174](https://github.com/magento/magento2/issues/36174)See in progress official PR: [magento/magento2#39476](https://github.com/magento/magento2/pull/39476)

Features
--------

[](#features)

- **Memoization:** Stores attribute option values in memory for faster repeated access during the same request lifecycle.
- **Caching:** Adds caching for custom attribute values fetched through `getAttributeText()` calls for improved overall performance.
- **Configuration Options in Admin Panel:** Allows enabling or disabling caching through a Magento System Configuration field.
- **Default Caching Behavior:** Automatically activates caching for custom attributes by setting `cache_user_defined_attributes` to `1` by default in the configuration.

Configuration
-------------

[](#configuration)

To manage the caching behavior, navigate to the **Admin Panel**:

1. Go to `Stores > Configuration > Advanced > Developer`.
2. Locate the **Caching** section.
3. Check the `Cache Attribute Options Values` setting:
    - **Yes (default):** Enables caching for attribute option values retrieved using `getAttributeText()`.
    - **No:** Disables caching.

Installation
------------

[](#installation)

1. Install the module using composer:
    `composer require blackbird/module-eav-optimize`
2. Run the following commands to register and enable the module:

    ```
    bin/magento module:enable Blackbird_EavOptimize
    bin/magento setup:upgrade
    bin/magento cache:flush
    ```

Technical Details
-----------------

[](#technical-details)

### Why Use EavOptimize?

[](#why-use-eavoptimize)

Fetching EAV attribute options using `getAttributeText()` in Magento can result in multiple redundant queries, especially in cases where multiple calls retrieve the same data. The `EavOptimize` plugin avoids such performance bottlenecks by leveraging memoization to reuse data within a single request and caching to persist retrieved attribute options across requests.

### Changes Introduced

[](#changes-introduced)

- The plugin overrides or interacts with default Magento EAV functionality to add memoization for EAV attribute option values at runtime in the class `Magento\Eav\Model\Entity\Attribute\Source\Table`.
- Adjustments are made to cache attribute options by default through `config.xml`: ```

                1
                1

    ```
- A system configuration option has been added (`system.xml`) to allow admin users to control caching behavior (`Cache Attribute Options Values`).

### Performance Benefits

[](#performance-benefits)

1. Reduces the number of database queries during attribute option lookups.
2. Improves overall page load times, especially for pages that frequently query for attribute text (e.g., product pages, category pages).
3. Ensures smoother performance under heavy load.

Compatibility
-------------

[](#compatibility)

This module is compatible with:

- **Magento 2** version 2.3.x and above.
- PHP version used should align with Magento's compatibility.

Usage Example
-------------

[](#usage-example)

### Without EavOptimize:

[](#without-eavoptimize)

When fetching an attribute's option text multiple times (e.g., by calling `getAttributeText()` in a loop), Magento may execute redundant database calls to retrieve the same data repeatedly.

### With EavOptimize:

[](#with-eavoptimize)

The plugin stores these values in memory through memoization during runtime. For subsequent calls, the data is fetched directly from memory or cache instead of querying the database.

Example:

```
$product = $productRepository->getById(1);
echo $product->getAttributeText('color'); // First call - fetched from DB or cache
echo $product->getAttributeText('color'); // Second call - fetched from memoized storage
```

---

Enjoy improved performance while managing your EAV attributes with EavOptimize! 🚀

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance41

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~26 days

Total

3

Last Release

466d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12445118?v=4)[anthony-blackbird](/maintainers/anthony-blackbird)[@anthony-blackbird](https://github.com/anthony-blackbird)

---

Top Contributors

[![anthony-blackbird](https://avatars.githubusercontent.com/u/12445118?v=4)](https://github.com/anthony-blackbird "anthony-blackbird (7 commits)")

### Embed Badge

![Health badge](/badges/blackbird-module-eav-optimize/health.svg)

```
[![Health](https://phpackages.com/badges/blackbird-module-eav-optimize/health.svg)](https://phpackages.com/packages/blackbird-module-eav-optimize)
```

###  Alternatives

[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)[swissup/module-search-mysql-legacy

Legacy mysql search for magento 2.4

10483.0k](/packages/swissup-module-search-mysql-legacy)[pagbank/payment-magento

PagBank - Payment for Magento and Adobe

2128.3k7](/packages/pagbank-payment-magento)[graycore/magento2-graphql-introspection-cache

1015.2k](/packages/graycore-magento2-graphql-introspection-cache)[opengento/module-category-import-export

This module add the capability to import and export the categories from the back-office.

119.1k](/packages/opengento-module-category-import-export)

PHPackages © 2026

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