https://github.com/aguilardc/moggiephp
Moggie PHP is a lightweight, syntax elegant web micro-framework.
https://github.com/aguilardc/moggiephp
api api-framework api-rest api-restfull framework-php microframework php restful-api
Last synced: 4 months ago
JSON representation
Moggie PHP is a lightweight, syntax elegant web micro-framework.
- Host: GitHub
- URL: https://github.com/aguilardc/moggiephp
- Owner: aguilardc
- Created: 2023-04-17T17:50:16.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-10T00:48:26.000Z (almost 3 years ago)
- Last Synced: 2025-06-24T06:08:28.015Z (8 months ago)
- Topics: api, api-framework, api-rest, api-restfull, framework-php, microframework, php, restful-api
- Language: PHP
- Homepage:
- Size: 55.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Moggie PHP
## 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](https://getcomposer.org/), 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.
```php
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.
```php
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 @.
```php
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](mailto: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](https://opensource.org/licenses/MIT).