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

ActiveLibrary[Framework](/categories/framework)

clagiordano/weblibs-mvc
=======================

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

v1.1.2(7y ago)087LGPL-3.0PHPPHP &gt;=5.4

Since Jul 31Pushed 7y agoCompare

[ Source](https://github.com/clagiordano/weblibs-mvc)[ Packagist](https://packagist.org/packages/clagiordano/weblibs-mvc)[ Docs](https://github.com/clagiordano/weblibs-mvc.git)[ RSS](/packages/clagiordano-weblibs-mvc/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (33)Used By (0)

[![BuildStatus](https://camo.githubusercontent.com/6b0f2b876f83eda9c8c57b83dc0052aa4900f50be347939d4b5c5d11af24933d/68747470733a2f2f7472617669732d63692e6f72672f636c6167696f7264616e6f2f7765626c6962732d6d76632e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/6b0f2b876f83eda9c8c57b83dc0052aa4900f50be347939d4b5c5d11af24933d/68747470733a2f2f7472617669732d63692e6f72672f636c6167696f7264616e6f2f7765626c6962732d6d76632e7376673f6272616e63683d6d6173746572) [![License](https://camo.githubusercontent.com/3edab803c9a647ff12e5fb3083b82186e9c9afdc5186ccc549e4af1fcb031517/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636c6167696f7264616e6f2f7765626c6962732d6d76632e737667)](https://camo.githubusercontent.com/3edab803c9a647ff12e5fb3083b82186e9c9afdc5186ccc549e4af1fcb031517/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636c6167696f7264616e6f2f7765626c6962732d6d76632e737667)

weblibs-mvc
===========

[](#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.

[![SensioLabsInsight](https://camo.githubusercontent.com/48ee6af0ccb628fac1e78d26c78c0eccc6f1b485f2419e52d5539ae5899556da/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f33333663633165322d313537652d343536632d383562612d3766313035363833666238302f6269672e706e67)](https://insight.sensiolabs.com/projects/336cc1e2-157e-456c-85ba-7f105683fb80)

Based on
Based on

Description of the main components
----------------------------------

[](#description-of-the-main-components)

Application
-----------

[](#application)

The application class is the main component wich handle and relates components between them.

### Controller

[](#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.

### Registry

[](#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.

### Routing

[](#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.

### Template

[](#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.

Installation
------------

[](#installation)

The recommended way to install weblibs-mvc is through [Composer](https://getcomposer.org).

```
composer require clagiordano/weblibs-mvc
```

### Adding RESTful support to destination project

[](#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:

```
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:

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

Usage
-----

[](#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();
```

Legal
-----

[](#legal)

*Copyright (C) Claudio Giordano *

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~30 days

Recently: every ~168 days

Total

29

Last Release

2903d ago

Major Versions

v0.9.10 → v1.02016-08-23

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8440925?v=4)[Claudio Giordano](/maintainers/clagiordano)[@clagiordano](https://github.com/clagiordano)

---

Top Contributors

[![clagiordano](https://avatars.githubusercontent.com/u/8440925?v=4)](https://github.com/clagiordano "clagiordano (135 commits)")

---

Tags

mvcphproutingweblibs-mvcapiframeworkroutingmvcrestfulclagiordanoweblibs

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/clagiordano-weblibs-mvc/health.svg)

```
[![Health](https://phpackages.com/badges/clagiordano-weblibs-mvc/health.svg)](https://phpackages.com/packages/clagiordano-weblibs-mvc)
```

###  Alternatives

[abydahana/aksara

Aksara is a CodeIgniter based CRUD Toolkit you can use to build complex applications become shorter, secure and more reliable just in a few lines of code. Serving both CMS or Framework, produce both HEADLESS (RESTful API) or TRADITIONAL (Browser Based), just by writing single controller. Yet it's reusable, scalable and ready to use!

1111.2k](/packages/abydahana-aksara)[patricksavalle/slim-rest-api

Production-grade REST-API App-class for PHP SLIM, in production on https://zaplog.pro (https://api.zaplog.pro/v1)

101.4k](/packages/patricksavalle-slim-rest-api)

PHPackages © 2026

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