Skip to content

Moggie PHP is a lightweight, syntax elegant web micro-framework.

Notifications You must be signed in to change notification settings

aguilardc/MoggiePHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moggie PHP

PHP Version required Moggie PHP Version Licence

About

Moggie PHP is a lightweight, syntax elegant web micro-framework.

Requirements

Moggie PHP requires PHP 8.1 or greater.

Installation

1. Download the files.

If you're using Composer, you can run the following command:

composer require aguilardc/moggie

OR you can download them directly and extract them to your web directory.

Routing

Routing in Moggie PHP is done by matching a URL pattern with a callback function.

Route::get('/', function () {
    echo "Hello world!";
});

Named Parameters

You can specify named parameters in your routes which will be passed along to your callback function.

Route::get('/users/:name/:id', function($name, $id){
    echo "hello, $name ($id)!";
});

Working with controllers

You can specify the name of a controller and the method to execute as a string.

the controller name must be separated from the action name with an @.

Route::get('/users', 'UsersController@read');

Route::get('/users/:id', 'UsersController@readById');

Route::post('/users', 'UsersController@create');

Route::put('/users/:id', 'UsersController@update');

Route::delete('/users/:id', 'UsersController@delete');

You can make use of static methods like GET, POST, PUT and DELETE

Note: The controller must be created in the /src/controllers directory and the called function must exist within it.

Security Vulnerabilities

If you discover a security vulnerability within Moggie PHP, please send an e-mail to Nevison Aguilar via aguilardc1105@gmail.com. All security vulnerabilities will be promptly addressed.

License

The Moggie PHP micro-framework is open-sourced software licensed under the MIT license.