2017 © Pedro Peláez
 

library weblibs-mvc

weblibs-mvc is an simple and lightweight php routing component.

image

clagiordano/weblibs-mvc

weblibs-mvc is an simple and lightweight php routing component.

  • Thursday, July 19, 2018
  • by clagiordano
  • Repository
  • 0 Watchers
  • 0 Stars
  • 46 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 32 Versions
  • 10 % Grown

The README.md

BuildStatus License, (*1)

weblibs-mvc

weblibs-mvc is an simple and lightweight php routing component. This component can have a RESTful support simply adding an .htaccess file, see below for more details., (*2)

SensioLabsInsight, (*3)

Based on http://php-html.net/tutorials/model-view-controller-in-php/
Based on http://phpro.org/tutorials/Model-View-Controller-MVC.html#9, (*4)

Description of the main components

Application

The application class is the main component wich handle and relates components between them., (*5)

Controller

The Controller is the C in MVC. The base controller is a simple abstract class that defines the structure of all controllers. By including the registry here, the registry is available to all class that extend from the base controller. An index() method has also been included in the base controller which means all controller classes that extend from it must have an index() method themselves., (*6)

Registry

The registry is an object where site wide variables can be stored without the use of globals. By passing the registry object to the controllers that need them, we avoid pollution of the global namespace and render our variables safe. We need to be able to set registry variables and to get them., (*7)

Routing

The router class is responsible for loading up the correct controller. It does nothing else. The value of the controller comes from the URL., (*8)

Template

The templates themselves are basically HTML files with a little PHP embedded. Do not let the separation Nazi's try to tell you that you need to have full separation of HTML and PHP. Remember, PHP is an embeddable scripting language. This is the sort of task it is designed for and makes an efficient templating language. The template files belong in the views directory., (*9)

Installation

The recommended way to install weblibs-mvc is through Composer., (*10)

composer require clagiordano/weblibs-mvc

Adding RESTful support to destination project

Simply add into yours project root a file named .htaccess
(webserver must be allow override) which contains the following lines:, (*11)

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]

this simple steps allow your application make RESTful calls like:, (*12)

http://www.example.com/clients/68563
http://www.example.com/access/login
http://www.example.com/chart/
http://www.example.com/products/6574

Usage

/**
 * Composer autoload
 */
require_once __DIR__ . '/vendor/autoload.php';

/**
 * Import required classes
 */
use clagiordano\weblibs\mvc\Application;
use clagiordano\weblibs\mvc\Registry;
use clagiordano\weblibs\mvc\Router;
use clagiordano\weblibs\mvc\Template;

/**
 * Init base application
 * @var Application $application
 */
$application = new Application();

/**
 * Router setup
 */
$application->setRouter(
    new Router($application)
);

/**
 * set the path to the controllers directory
 */
$application->getRouter()->setControllersPath(
    __DIR__ . '/controllers'
);

/**
 * Template setup
 */
$application->setTemplate(
    new Template($application)
);

/**
 * load the controller / run the application
 */
$application->getRouter()->loader();

Copyright (C) Claudio Giordano claudio.giordano@autistici.org, (*13)

The Versions

19/07 2018

dev-master

9999999-dev https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

The Development Requires

by Claudio Giordano

api framework mvc restful routing clagiordano weblibs

19/07 2018

dev-develop

dev-develop https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

The Development Requires

by Claudio Giordano

api framework mvc restful routing clagiordano weblibs

19/07 2018

v1.1.2

1.1.2.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

The Development Requires

by Claudio Giordano

api framework mvc restful routing clagiordano weblibs

24/11 2016

v1.1

1.1.0.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

api framework mvc restful routing clagiordano weblibs

05/10 2016

v1.0.4

1.0.4.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

api framework mvc restful routing clagiordano weblibs

05/10 2016

v1.0.3

1.0.3.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

api framework mvc restful routing clagiordano weblibs

15/09 2016

v1.0.2

1.0.2.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

api framework mvc restful routing clagiordano weblibs

09/09 2016

v1.0.1

1.0.1.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

api framework mvc restful routing clagiordano weblibs

23/08 2016

v1.0

1.0.0.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

api framework mvc restful routing clagiordano weblibs

14/05 2016

v0.9.10

0.9.10.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

12/05 2016

v0.9.9

0.9.9.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

08/05 2016

v0.9.8

0.9.8.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

03/05 2016

v0.9.7

0.9.7.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

01/05 2016

v0.9.6

0.9.6.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

01/05 2016

v0.9.5

0.9.5.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

25/04 2016

v0.9.4

0.9.4.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

25/04 2016

v0.9.3

0.9.3.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

02/04 2016

v0.9.2

0.9.2.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

02/04 2016

v0.9.1

0.9.1.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

02/04 2016

v0.9

0.9.0.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

02/04 2016

v0.8.3

0.8.3.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

02/04 2016

v0.8.2

0.8.2.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

02/04 2016

v0.8.1

0.8.1.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

02/04 2016

v0.8

0.8.0.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

02/04 2016

v0.7.3

0.7.3.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

31/03 2016

v0.7.2

0.7.2.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

31/03 2016

v0.7.1

0.7.1.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

31/03 2016

v0.7

0.7.0.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

31/03 2016

v0.6.1

0.6.1.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

31/03 2016

v0.6

0.6.0.0 https://github.com/clagiordano/weblibs-mvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

31/03 2016

v0.5

0.5.0.0 https://github.com/clagiordano/webmvc.git

weblibs-mvc is an simple and lightweight php routing component.

  Sources   Download

GPL-3.0

The Requires

  • php >=5.4

 

by Claudio Giordano

31/07 2015

dev-feature-refactor-mvc

dev-feature-refactor-mvc

  Sources   Download

by Claudio Giordano