PHPackages                             piano/mvc - 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. piano/mvc

ActiveLibrary[Framework](/categories/framework)

piano/mvc
=========

A very simple MVC support and routing.

1.6.3.1(10y ago)62232[1 PRs](https://github.com/diogocavilha/Piano/pulls)PHPCI passing

Since Jul 15Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/diogocavilha/Piano)[ Packagist](https://packagist.org/packages/piano/mvc)[ RSS](/packages/piano-mvc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (28)Used By (0)

[![Build Status](https://camo.githubusercontent.com/78ca6b6bb1a8380f38b567afd05077bde0fd8d1779086c6e2128f8975b5d8333/68747470733a2f2f7472617669732d63692e6f72672f64696f676f636176696c68612f5069616e6f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/diogocavilha/Piano)

Piano MVC
=========

[](#piano-mvc)

This is not a micro/mini/whatever framework nor claims to be.

It's only a very simple MVC structure.

> WARNING: This has been just like a lab. I don't update this project anymore. If you want to use it, the ball is on your court.

Creating the project structure
==============================

[](#creating-the-project-structure)

```
composer create-project piano/mvc:dev-application myProject
```

Controller
----------

[](#controller)

#### Redirecting

[](#redirecting)

```
$this->redirect('/module/controller/action');
```

#### Redirecting with variables

[](#redirecting-with-variables)

```
$this->redirect(
    '/module/controller/action',
    [
        'firstName' => 'Diogo',
        'lastName' => 'Cavilha',
    ]
);
```

#### Getting params by name

[](#getting-params-by-name)

```
$id = $this->getParam('id');
```

#### Getting all params

[](#getting-all-params)

```
$params = $this->getParams();
```

Methods from `Piano\Mvc\Controller`
-----------------------------------

[](#methods-from-pianomvccontroller)

##### initialize()

[](#initialize)

If you need to create a constructor method for your controller, you can do this by creating a method called `initialize()` instead of `__construct()`. The `__construct()` method is already being used by `Piano\Mvc\Controller`.

#### Example:

[](#example)

```
