PHPackages                             vkr/view-materializer-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. vkr/view-materializer-bundle

AbandonedSymfony-bundle[Database &amp; ORM](/categories/database)

vkr/view-materializer-bundle
============================

A bundle for emulating materialized views in MySQL, made for Symfony2/3 and Doctrine

1.0.3(9y ago)134MITPHPPHP &gt;=5.6

Since Jul 17Pushed 9y ago1 watchersCompare

[ Source](https://github.com/wladislavk/ViewMaterializerBundle)[ Packagist](https://packagist.org/packages/vkr/view-materializer-bundle)[ Docs](https://github.com/wladislavk/ViewMaterializerBundle)[ RSS](/packages/vkr-view-materializer-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (5)Versions (5)Used By (0)

About
=====

[](#about)

A materialized view is a table that does not contain any original data - any of its data comes from a SELECT query on some other tables. Unlike simple views, materialized views are stored on disk as simple tables. Any query on a materialized view works much faster than on a simple view, however, materialized views need to be regularly updated to reflect changes in their underlying tables. Some DB engines have default support for view materialization, but MySQL does not.

This is a simple bundle that was created to emulate materialized views in MySQL. It depends on Doctrine and is available both as stand-alone service and console command that can be launched via Cron. It also depends on VKRCustomLoggerBundle.

Currently, this bundle does not support multiple DB connections and will always use default connection.

Installation
============

[](#installation)

Besides enabling the bundle in your `AppKernel.php`, you must configure it and create a log file.

The log file needs to be placed into `/app/logs/`, it should have `.log` extension and, of course, it should be open for writing.

To configure the bundle, create `vkr_view_materializer` key in your `config.yml`or in any other included configuration file. Under this key, you need two keys: `log_file`contains your log file name without path and extension. `views` key contains the main bulk of configuration, namely - a dictionary with keys that correspond to materialized view names and values that are SELECT queries that create these views.

Example in YAML:

```
vkr_view_materializer:
    log_file: view_materializer
    views:
        first_mview: "SELECT a from table1 WHERE b=c"

```

Usage
=====

[](#usage)

There are two ways to use this bundle - from a controller or from console.

If you use it from the console, enter `php app/console views:materialize`. If your configuration is as in the example above, Doctrine will attempt to make these queries:

```
DROP TABLE IF EXISTS first_mview;
CREATE TABLE first_mview AS SELECT a from table1 WHERE b=c;

```

If you are using Symfony 3, swap `app/console` for `bin/console`.

If there are any errors, they will be output to your log file.

From the controller, you need to call:

```
$materializer = $this->get('vkr_view_materializer.view_materializer');
$isSuccessful = $materializer->materializeViews();

```

If there are any errors, `false` will be returned and the errors logged to the file.

API
===

[](#api)

*void ViewMaterializer::\_\_construct(Doctrine\\ORM\\EntityManager $em, VKR\\CustomLoggerBundle\\Services\\CustomLogger $logger, string\[\] $definitions, string $logFile)*

*bool ViewMaterializer::materializeViews()*

In case of an error while executing a query, execution will be immediately stopped and false returned. Otherwise, returns true.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~83 days

Total

4

Last Release

3339d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79f5fa971e7fda7a6180c1bdfca4f819a43b7681ec4e04c66b184a082fb5a20f?d=identicon)[wladislavk](/maintainers/wladislavk)

---

Top Contributors

[![wladislavk](https://avatars.githubusercontent.com/u/11371476?v=4)](https://github.com/wladislavk "wladislavk (4 commits)")

---

Tags

mysqldoctrineSymfony2viewssymfony3

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vkr-view-materializer-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/vkr-view-materializer-bundle/health.svg)](https://phpackages.com/packages/vkr-view-materializer-bundle)
```

###  Alternatives

[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M36](/packages/scienta-doctrine-json-functions)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[data-dog/audit-bundle

Audit bundle for symfony2 and doctrine orm, logs any database change

141901.7k1](/packages/data-dog-audit-bundle)[webonaute/doctrine-fixtures-generator-bundle

Generate Fixture from your existing data in your database. You can specify the Entity name and the IDs you want to import in your fixture.

67184.1k](/packages/webonaute-doctrine-fixtures-generator-bundle)[petkopara/crud-generator-bundle

Symfony3 bundle for CRUD generation with pagination, filtering, sorting, page size, bulk delete and bootstrap3 markup. This Generator supports Doctrine association mapping.

7257.9k](/packages/petkopara-crud-generator-bundle)[damianociarla/dynamic-discriminator-map-bundle

DCSDynamicDiscriminatorMapBundle simplifies the use of Doctrine Single Table Inheritance mapping strategy in Symfony2.

1237.7k](/packages/damianociarla-dynamic-discriminator-map-bundle)

PHPackages © 2026

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