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,MVCPattern,View TemplatingAndSmart Response, And Other Features You Will ExploreI'm a big Fan of
LaravelFramework And Big Thanks ToTaylor Otwelland 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_rewriteapache module to be enabled
- MVC (Model, View And Controller) Pattern
- REST API for
CRUDOperations - 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_atandupdated_atTimestamps 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 namedtimestampsass 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 calledcastsand add[field => cast_type] - View Basic Templating Like
@extends,@include,@section @stop,@yield,{{ }},{!! !!}Template Loops@for@foreachand Conditions@ifCurrently 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
ConfigApplication Configuration
ControllersApplication Controllers
AdminAdmin Area Controllers
LibraryFramework Core Library
ModelApplication Models
ViewApplication Views
assetsApplication Public Accisible Area
Configuration: App\Config\
database.phpis to configure your database.
gateway.phpis to configure Application Access For Specific Uris.
simpleDateTimeLocals.phpto 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/
GETRequest will CallIndexController::index()Default Controller is IndexController
my-app.dev/test
GETRequest will CallTestController::index()
POSTRequest Will CallTestController::store( Request $request )
my-app.dev/test/1Second URI Part Is Numeric
GETRequest will CallTestController::show( Test $record_instance )Note thatTestModel Instance Will Be Injected Automatically, Model Name Is The Same AS Controller Name withoutControllerKeyword
PUTORPATCHRequest Will CallTestController::update( Test $record, Request $request )
DELETERequest 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
GETRequest will CallTestController::edit( Test $record_instance )
my-app.dev/test/delete/1
GETRequest will CallTestController::delete( Test $record_instance )Other URIs
my-app.dev/test/method_name/parameter1/parameter2/..
GETRequest will CallTestController::methodName( $parameter1, $parameter2[, ..] )Other Request Methods ARE
CUDSo They Requires $parameter1 To Be ID of Controller Corresponding Model AND Other Parameters Are Ignored
postwill CallTestController::postMethodName( Test $record, Request $request )
PUTOR'PATCHwill CallTestController::updateMethodName( Test $record, Request $request )
DELETEwill CallTestController::deleteMethodName( Test $record, Request $request )
For Admin Area:
my-app.dev/admin
/adminuri will be used to access admin areacontrollers will be loaded From
admindirectory insidecontrollersdirectorydefault admin controller is
DashboardControlleris for/adminuri-- 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
SingularOrPluralas 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 )
