PHPackages                             beyerz/simple-hmvc-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. [Framework](/categories/framework)
4. /
5. beyerz/simple-hmvc-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

beyerz/simple-hmvc-bundle
=========================

Symfony bundle to support the HMVC design pattern

v2.0.5(7y ago)13.9k1MITPHPPHP &gt;=5.6

Since Mar 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/beyerz/SimpleHMVCBundle)[ Packagist](https://packagist.org/packages/beyerz/simple-hmvc-bundle)[ RSS](/packages/beyerz-simple-hmvc-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (3)Versions (10)Used By (0)

SimpleHMVCBundle
================

[](#simplehmvcbundle)

Simple HMVC Bundle for Symfony2

The HMVC design pattern, came about when trying resolve the problem of embedding widgets into pages. HMVC allows us to cleanly separate Controller, Model and View logic's, enabling us to create easier to work with and clearly encompassed code.

Symfony2 does provide us with tools that allow us to "load" routes within our controllers and our views, but the process, behind the scenes, is more complex than I like.

For info on embedding using the symfony provided options see:

HMVC (Hierarchical model-view-controller) symfony bundle enables you to "Widgetize" or as used in this bundle "Elementize" your controllers. Architecturally this allows you to recursively include the same element one or many times across multiple pages without having to rebuild or restate the model logic.

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

[](#installation)

### Composer (Recommended)

[](#composer-recommended)

```
composer require beyerz/simple-hmvc-bundle

```

### Application Kernel

[](#application-kernel)

Add SimpleHMVC to the `registerBundles()` method of your application kernel:

```
public function registerBundles()
{
    return array(
        new Beyerz\SimpleHMVCBundle\BeyerzSimpleHMVCBundle(),
    );
}
```

Usage
=====

[](#usage)

Pages and Elements can be created by hand or generated using the provided commands. If you choose to create them manually or need to update manually, please consider the expected file structure

### Creating Pages

[](#creating-pages)

Using the command

```
php app/console hmvc:page
```

For additional options or help

```
php app/console hmvc:page --help
```

This command will generate a controller with one or many actions according to your specification. For every controller action the following classes will be created, {action}Model, {action}Context, {action}Input and a view in snake case format.

The creation of a page with results in the following directory structure The Controller name used here is: BeyerzTestingBundle:GitExample

```
├── Context
│   └── Page
│       └── GitExample
│           ├── FirstExampleContext.php
│           └── SecondExampleContext.php
├── Controller
│   └── Page
│       └── GitExampleController.php
├── Input
│   └── Page
│       └── GitExample
│           ├── FirstExampleInput.php
│           └── SecondExampleInput.php
├── Model
│   └── Page
│       └── GitExample
│           ├── FirstExampleModel.php
│           └── SecondExampleModel.php
├── Resources
│   ├── config
│   │   ├── routing.yml
│   │   └── services.yml
│   └── views
│       └── Page
│           └── GitExample
│               ├── first_example.html.twig
│               └── second_example.html.twig
└── Tests
    └── Controller
        └── Page
            └── GitExampleControllerTest.php

```

You can also create controllers under different directories by specifying the path during the creation. A simple sub-controller would generate this file structure The Controller name used here is: BeyerzTestingBundle:GitExample/SubExample

```
├── Context
│   └── Page
│       └── GitExample
│           └── SubExample
│               ├── FirstSubExampleContext.php
│               └── SecondSubExampleContext.php
├── Controller
│   └── Page
│       └── GitExample
│           └── SubExampleController.php
├── Input
│   └── Page
│       └── GitExample
│           └── SubExample
│               ├── FirstSubExampleInput.php
│               └── SecondSubExampleInput.php
├── Model
│   └── Page
│       └── GitExample
│           └── SubExample
│               ├── FirstSubExampleModel.php
│               └── SecondSubExampleModel.php
├── Resources
│   ├── config
│   │   ├── routing.yml
│   │   └── services.yml
│   └── views
│       └── Page
│           └── GitExample
│               └── SubExample
│                   ├── first_sub_example.html.twig
│                   └── second_sub_example.html.twig
└── Tests
    └── Controller
        └── Page
            └── GitExample
                └── SubExampleControllerTest.php

```

### Creating Elements

[](#creating-elements)

Elements are very similar to pages, except that no controller is generated for elements.

Using the command

```
php app/console hmvc:element
```

For additional options or help

```
php app/console hmvc:element --help
```

This command will generate the following classes, {element}Model, {element}Context, {element}Input and a view in snake case format.

The creation of an element results in the following directory structure The Element name used here is: BeyerzTestingBundle:GitElement

```
├── Context
│   └── Element
│       └── GitElementContext.php
├── Controller
├── DependencyInjection
│   ├── BeyerzTestingExtension.php
│   └── Configuration.php
├── Input
│   └── Element
│       └── GitElementInput.php
├── Model
│   └── Element
│       └── GitElementModel.php
├── Resources
│   ├── config
│   │   ├── routing.yml
│   │   └── services.yml
│   └── views
│       └── Element
│           └── git_element.html.twig
└── Tests

```

You can also create elements under different directories by specifying the path during the creation. A simple sub-element would generate this file structure The element name used here is: BeyerzTestingBundle:GitExample/SubElement

```
├── Context
│   └── Element
│       └── GitExample
│           └── SubElementContext.php
├── Controller
├── DependencyInjection
│   ├── BeyerzTestingExtension.php
│   └── Configuration.php
├── Input
│   └── Element
│       └── GitExample
│           └── SubElementInput.php
├── Model
│   └── Element
│       └── GitExample
│           └── SubElementModel.php
├── Resources
│   ├── config
│   │   ├── routing.yml
│   │   └── services.yml
│   └── views
│       └── Element
│           └── GitExample
│               └── sub_element.html.twig
└── Tests

```

How it works
------------

[](#how-it-works)

Some useful articles
--------------------

[](#some-useful-articles)

-

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 94.1% 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 ~95 days

Recently: every ~143 days

Total

9

Last Release

2583d ago

Major Versions

1.0.2 → 2.0.02017-07-19

PHP version history (2 changes)1.0.0PHP &gt;=5.5

2.0.4PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/3812d8934a9934b62846482516124b3cd6c95a1e7457d9f693ddd0fefd9b79dd?d=identicon)[beyerz](/maintainers/beyerz)

---

Top Contributors

[![beyerz](https://avatars.githubusercontent.com/u/4946849?v=4)](https://github.com/beyerz "beyerz (16 commits)")[![ArkadyBirko](https://avatars.githubusercontent.com/u/35292743?v=4)](https://github.com/ArkadyBirko "ArkadyBirko (1 commits)")

---

Tags

hmvchmvc-bundlesymfonysymfony-bundlesymfonySymfony2hmvcHierarchical model view controller

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/beyerz-simple-hmvc-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/beyerz-simple-hmvc-bundle/health.svg)](https://phpackages.com/packages/beyerz-simple-hmvc-bundle)
```

###  Alternatives

[krzysiekpiasecki/gentelella

A Symfony skeleton application with user account functionality based on the Twitter Bootstrap and Gentelella template

991.8k](/packages/krzysiekpiasecki-gentelella)[ibrahimgunduz34/maria-bundle

A Rule Engine Implementation For Symfony Projects

151.1k](/packages/ibrahimgunduz34-maria-bundle)

PHPackages © 2026

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