Code Monkey home page Code Monkey logo

hmvc's Introduction

Shale

Build Status

HMVC modules for Silex

#HMVC

Many modern web frameworks are built using the Model View Controller (MVC) design pattern. The HMVC pattern takes this one step further by implement a Hierarchical Model View Controller. HMVC is a collection of Model-View-Controller modules. Each module can operate indepdently from one another. However, one module can easily consume other MVC modules. This method encourages code reusibility and DRY (Don't-Repeat-Yourself) code. HMVC encourages small, testable, reusable components.

#Why Silex

Some popular HMVC implementations in the past include the Kohana Framework and the HMVC extension for Code Igniter. These implementations are built on top of "full stack" frameworks. The Shale HMVC implementation is built on top of the Silex microframework. This microframework gives developers more decisions about what tools he or she wants to integrate in his or her application. The Shale HMVC implementation provides a structural component for packaging modules as dependencies within the Silex DI Container.

#Usage

To use Shale HMVC, one should be familiar with Silex and the Service Controller Service Provider. The Shale implementation works similarly. Routes should be handled using the Service Module Service Provider. This allows you to package Models, Views and Controllers inside of the provided Module class. The Module acts as a proxy for user defined Controllers. The module requires that every controller returns an instance of the Symfony HttpFoundation component Response. This allows modules to stand alone, but also be easily consumed by one another. The module class simply enforces these contstraints.

#Example

See the example included in the code example for more information

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.