This is simple MVC PHP Framework May Be Suitable For Small And Medium projects According To Your Project Requirements, It Is
REST API
,Clean Uris
,MVC
Pattern,View Templating
AndSmart Response
, And Other Features You Will ExploreI'm a big Fan of
Laravel
Framework And Big Thanks ToTaylor Otwell
and Other Contributors For His Great Framework, So You Might Find here Some method names like in Laravel
This Work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
@author Ahmed Saad a7mad.sa3d.2014@gmail.com 2012-2016
2.0.0
Framework uses Clean URIs so it needs
mod_rewrite
apache module to be enabled
- MVC (Model, View And Controller) Pattern
- REST API for
CRUD
Operations - Clean
URI
- Gateway To Protect Uris
- Handle Validation, With Custom Validation Error Messages Very Useful If You need Error messages In Another Representation Or Language
- Smart Response, Useful For APIs and Json Response
- Handle Uploads And Inputs
- Controller Record Model Injection For Known Methods Like show, edit, delete, destroy, update, store
- SimpleDateTime Class For Dealing With dates
- Model Auto Casting, By Default
created_at
andupdated_at
Timestamps Attributes will be Auto casted For Any Model If you want to override this behaviour By adding fields or remove fields you can define protected property namedtimestamps
ass array and type date fields that you want to be casted , And For Other fields Casting types You can Define Your casting from one of ( integer, boolean, array ) by adding protected array property calledcasts
and add[field => cast_type]
- View Basic Templating Like
@extends
,@include
,@section @stop
,@yield
,{{ }}
,{!! !!}
Template Loops@for
@foreach
and Conditions@if
Currently Not Supported You Can Use Native - Access to Old Inputs, Notiications, Validation Errors From View
Well Documented Library
- And Many Other Features You Can Explore.
- Include Admin Area With Full User Management To Demonestrate How It Works
Directory Structure:
App
Config
Application Configuration
Controllers
Application Controllers
Admin
Admin Area Controllers
Library
Framework Core Library
Model
Application Models
View
Application Views
assets
Application Public Accisible Area
Configuration: App\Config\
database.php
is to configure your database.
gateway.php
is to configure Application Access For Specific Uris.
simpleDateTimeLocals.php
to Specify Locals For SimpleDateTime Class.
Application Routes:
No Need To Define Routes Framework Will Automatically Analyze Request URI And Accordingly Will Try To Load Controller And Method If Found Ex:
my-app.dev/
GET
Request will CallIndexController::index()
Default Controller is IndexController
my-app.dev/test
GET
Request will CallTestController::index()
POST
Request Will CallTestController::store( Request $request )
my-app.dev/test/1
Second URI Part Is Numeric
GET
Request will CallTestController::show( Test $record_instance )
Note thatTest
Model Instance Will Be Injected Automatically, Model Name Is The Same AS Controller Name withoutController
Keyword
PUT
ORPATCH
Request Will CallTestController::update( Test $record, Request $request )
DELETE
Request Will CallTestController::destroy( Test $record, Request $request )
Second URI Part Is String
Edit And delete Uris, Will Inject Model Instance Automatically
my-app.dev/test/edit/1
GET
Request will CallTestController::edit( Test $record_instance )
my-app.dev/test/delete/1
GET
Request will CallTestController::delete( Test $record_instance )
Other URIs
my-app.dev/test/method_name/parameter1/parameter2/..
GET
Request will CallTestController::methodName( $parameter1, $parameter2[, ..] )
Other Request Methods ARE
CUD
So They Requires $parameter1 To Be ID of Controller Corresponding Model AND Other Parameters Are Ignored
post
will CallTestController::postMethodName( Test $record, Request $request )
PUT
OR'PATCH
will CallTestController::updateMethodName( Test $record, Request $request )
DELETE
will CallTestController::deleteMethodName( Test $record, Request $request )
For Admin Area:
my-app.dev/admin
/admin
uri will be used to access admin areacontrollers will be loaded From
admin
directory insidecontrollers
directorydefault admin controller is
DashboardController
is for/admin
uri-- Note:
When Framework It Automatically Inject Model For Controller Method It Will search for Model name That Have The same Name As Controller, So While Naming Controllers And Models Try To Match Both if in
Singular
OrPlural
as you wish
###How It Works:
there are Simple admin area included with framework ( You Can Improve Access Roles By Creating Your Database Roles And Permissions Table Structurs And Connect Them With Users, Then Add Checks In Gateway Configuration File ), with users management you can explore UserController
and User
Model and user views
to see How It Works
create your database
Set Database Configuration
Import included Database ( it is users table structure and data )