PHPackages                             prwhitehead/meagr - 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. prwhitehead/meagr

ActiveLibrary[Framework](/categories/framework)

prwhitehead/meagr
=================

Framework helpers and classes

015PHP

Since Jan 7Pushed 12y ago1 watchersCompare

[ Source](https://github.com/prwhitehead/Meagr)[ Packagist](https://packagist.org/packages/prwhitehead/meagr)[ RSS](/packages/prwhitehead-meagr/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Meagr
=====

[](#meagr)

A small, focused framework for small-ish projects that require an aspect of H/MVC and a lightweight MySQL ORM/Model. With a bootstrap Form class, Environment specific config, CSS/JS/HTML Caching, S3 interface, Encryption, Validation, automatic db schema creation, Auth, Timer, Nonce and helpers for Inputand Arrays.

Folder structure
----------------

[](#folder-structure)

Meagr allows you some flexibility when setting up your application. The main set of system classes can be found in the composer package which is added to your vendor folder with the following require command in your composer.json file

```
"require": {
    "prwhitehead/meagr": "dev-master"
}

```

Once the files have been installed and ready to be used, you must setup your modules / application folder. Because of the way the non-composer autoloader works, whatever folder you place your files will define your namespacing.

The files are required for the routing, config etc. The 'modules' folder if where your application will sit. It was called 'modules' and not 'app', or 'application' as each module could be a seperate micro-application, performing a certain set of tasks.

Modules modules should be namespaced as follows

```
/Modules/YourModulesName

```

This namespace matches the folder name and structure of your controllers/models/views folders

```
/Modules/YourModulesName/Controllers/Classname

```

Sub controllers can also be used by using the underscore in the filename.

```
/admin/user/create

```

Would first look to find an Admin controller class, which contained a GET\_user method and pass in 'create' as a variable. The next check would look to find the Admin\_User controller which is in admin\_user.php within the admin app folder

```
/modules/admin/controllers/admin_user.php

```

For the method:

```
Admin_User::GET_create();

```

Routing
-------

[](#routing)

By default a website can use either an MVC or HMVC structure, which uses:

```
http://www.example.com/news/latest

```

Which would route to either:

```
modules/news/controllers/news.php

```

or:

```
modules/controllers/news.php

```

The HMVC structure takes presidence and over MVC which is the default.

If we were using the HMVC structure for our app modules, the system will look for the following class and method

```
