PHPackages                             kenny1911/doctrine-views-sync - 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. kenny1911/doctrine-views-sync

ActiveLibrary[Database &amp; ORM](/categories/database)

kenny1911/doctrine-views-sync
=============================

Tools for sync database views, using doctrine

0.2.0(11mo ago)02.2k↓45.5%[2 issues](https://github.com/Kenny1911/doctrine-views-sync/issues)MITPHPPHP ^8.1CI passing

Since Jun 5Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/Kenny1911/doctrine-views-sync)[ Packagist](https://packagist.org/packages/kenny1911/doctrine-views-sync)[ RSS](/packages/kenny1911-doctrine-views-sync/feed)WikiDiscussions 0.2.x Synced 2d ago

READMEChangelog (2)Dependencies (6)Versions (5)Used By (0)

Doctrine Views Sync
===================

[](#doctrine-views-sync)

\[ English | [Русский](./README-RU.md) \]

**Doctrine Views Sync** is a lightweight utility for managing database views in Doctrine-based projects. It allows you to **synchronize** or **drop** all views via console commands.

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

[](#installation)

Install the package via Composer:

```
composer require kenny1911/doctrine-views-sync
```

Usage
-----

[](#usage)

Two console commands are available:

### Drop all views

[](#drop-all-views)

```
php bin/console doctrine:views:drop
```

Drops all views in the database that are defined in your project.

### Synchronize views

[](#synchronize-views)

```
php bin/console doctrine:views:sync
```

Synchronizes all views — recreates them based on the current application state.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Doctrine DBAL
- Symfony Console (if used outside of Symfony, additional setup may be required)

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

[](#configuration)

### Symfony Framework

[](#symfony-framework)

Example Symfony configuration using a single Doctrine connection.

Basic service registration and command wiring:

```
services:
  doctrine.views_provider:
    class: Kenny1911\DoctrineViewsSync\ViewsProvider\ChainViewsProvider
    arguments:
      - !tagged_iterator 'doctrine.views_provider'

  doctrine.views_sync.metadata_storage:
    class: Kenny1911\DoctrineViewsSync\Metadata\TableMetadataStorage
    arguments:
      - '@doctrine.dbal.default_connection'

  doctrine.views_sync.factory:
    class: Kenny1911\DoctrineViewsSync\ViewsSyncFactory
    factory: [null, 'fromSingleConnection']
    arguments:
      - '@doctrine.dbal.default_connection'
      - '@doctrine.views_provider'
      - '@doctrine.views_sync.metadata_storage'

  Kenny1911\DoctrineViewsSync\Console\ViewsDropCommand:
    arguments:
      - '@doctrine.views_sync.factory'
    autoconfigure: true

  Kenny1911\DoctrineViewsSync\Console\ViewsSyncCommand:
    arguments:
      - '@doctrine.views_sync.factory'
    autoconfigure: true
```

Services implementing the `Kenny1911\DoctrineViewsSync\ViewsProvider` interface must be tagged with `doctrine.views_provider`.

Example `ViewsProvider` implementation:

```
use Doctrine\DBAL\Schema\View;

final readonly class UsersViewsProvider implements \Kenny1911\DoctrineViewsSync\ViewsProvider
{
    public function getViews() : iterable
    {
        yield new View(
            name: 'users_credentials',
            sql: 'SELECT id, username, password FROM users',
        );
    }
}
```

```
services:
  UsersViewsProvider:
    tags:
      - 'doctrine.views_provider'
```

To configure the database schema, use the `TableMetadataStorage::configureSchema()` method.

Development
-----------

[](#development)

Tests will run with in-memory sqlite db by default.

If you want to run tests with other dbms, set environment variable `DATABASE_URL`.

File `docker-compose.yml` contains prepared settings for different dbms. You must run database servers before run tests and down after tests was passed.

Running tests example:

```
# Postgres
DATABASE_URL='pdo-pgsql://postgres:123@localhost:5432/views-sync' ./vendor/bin/phpunit
```

License
-------

[](#license)

MIT

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance51

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

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

Total

4

Last Release

346d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c929378f19c1e2e6a9525debcf490ec49c991a3d1ac6133e3c9fa45cef184102?d=identicon)[Kenny1911](/maintainers/Kenny1911)

---

Top Contributors

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

---

Tags

databaseormdoctrinedbaltooldbviewviews

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kenny1911-doctrine-views-sync/health.svg)

```
[![Health](https://phpackages.com/badges/kenny1911-doctrine-views-sync/health.svg)](https://phpackages.com/packages/kenny1911-doctrine-views-sync)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k300.5M7.5k](/packages/doctrine-orm)[doctrine/doctrine-bundle

Symfony DoctrineBundle

4.8k254.4M4.1k](/packages/doctrine-doctrine-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M204](/packages/sulu-sulu)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.8k](/packages/contao-core-bundle)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8465.5M96](/packages/laravel-doctrine-orm)

PHPackages © 2026

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