2017 © Pedro Peláez
 

library lmvc

LMVC is an easy-to-use and extensible PHP (5.4) MVC framework

image

scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.4) MVC framework

  • Wednesday, November 13, 2013
  • by scandio
  • Repository
  • 15 Watchers
  • 4 Stars
  • 386 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

LMVC (cool)

Lean Model View Controller

This project contains a very small MVC framework written with simple PHP classes. It's not for production use but for learning purpose. It's developed with the following boundary conditions:, (*1)

  • Just PHP - no external PHP libraries
  • Convention over configuration
  • No annotations or other stuff like that
  • PSR-0 standard

Currently there is no documentation for anything., (*2)

How To

You have to change the .htaccess file if you want to try it, (*3)

RewriteRule ^(.*)$ /path/to/your/index.php?app-slug=$1 [L,QSA]

Controllers and actions

http:://host/base-path/controller/action/param1/param2

The URL above shows the controller & action with theirs params, (*4)

http:://host/base-path/

is a special controller and a special action. In this case the controller is named Application and the action index(), (*5)

http:://host/base_path/xyz

Here the controller is Xyz and the action is index(), (*6)

http:://host/base_path/xyz/do

Again the controller is Xyz and the action is do(), (*7)

To develop your own controller create a file with the same name like the class in the controllers directory, (*8)

e.g. Accounts.php

Create a class as a descendant of class Controller, (*9)

class Accounts extends \Scandio\lmvc\framework\Controller { }

Create a public static method named like the action you want to call, (*10)

class Accounts extends \Scandio\lmvc\framework\Controller {

    public static function index() {
        print_r('ok');
    }

}

Try to call, (*11)

http://host/base-path/accounts/

Rendering views

Currently LMVC supports two rendering options. First the standard HTML rendering. Second the JSON output. The class Controller is having two static methods for that. All data that have to be passed to the template or to JSON must be set by setRenderArg()., (*12)

Example for HTML rendering:, (*13)

class Accounts extends Controller {

    public static function index() {
        return self::render()
    }

}

This renders the view (template) registeredViewPaths/controller/action.html. In this case views/accounts/index.html. To pass some data to the template you can..., (*14)

class Accounts extends \Scandio\lmvc\framework\Controller {

    public static function index() {
        self::setRenderArg('name', 'John Doe');
        return self::render()
    }

}

or, (*15)

class Accounts extends Controller {

    public static function index() {
        self::render(array('name' => 'John Doe'));
    }

}

or both. There is no specific template language. It's just PHP. Every render argument is accessible as a local variable., (*16)

<h1>Hello <?= $name ?></h1>

Example for JSON rendering, (*17)

class Accounts extends \Scandio\lmvc\framework\Controller {

    public static function index() {
        self::renderJson(array('name' => 'John Doe'));
    }

}

has an output like, (*18)

{"name": "John Doe"}

The Versions

13/11 2013

dev-renderer

dev-renderer https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.4) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.4

 

php library mvc scandio

27/10 2013

dev-master

9999999-dev https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.4) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.4

 

php library mvc scandio

27/10 2013

0.4.3

0.4.3.0 https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.3) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.3

 

php library mvc scandio

12/08 2013

0.4.2

0.4.2.0 https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.3) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.3

 

php library mvc scandio

12/08 2013

0.4.1

0.4.1.0 https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.3) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.3

 

php library mvc scandio

12/08 2013

0.4

0.4.0.0 https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.3) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.3

 

php library mvc scandio

23/07 2013

dev-feature/httpcodes

dev-feature/httpcodes https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.3) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.3

 

php library mvc scandio

23/07 2013

dev-feature/assetpipeline

dev-feature/assetpipeline https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.3) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.3

 

php library mvc scandio

04/04 2013

0.3

0.3.0.0 https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.3) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.3

 

php library mvc scandio

25/03 2013

dev-lmvc-composer

dev-lmvc-composer https://github.com/scandio/lmvc

LMVC is an easy-to-use and extensible PHP (5.3) MVC framework

  Sources   Download

MIT

The Requires

  • php >=5.3

 

php library mvc scandio