ebnibrahem / m5-php7

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

M5

  • PHP MVC Framework used design pattern and modern approaches of reused of code and DRY (dont repeat yourself).
  • mic5 support php7

Installation

Server Requirements

  • PHP >= 7.x
  • Mbstring PHP Extension

Files:

  1. unzip files. https://github.com/ebnibrahem/m5/archive/master.zip

Configuration

Database:

  1. Open phpmyadmin and create your database and set collation as utf_general_ci.
  2. open app/config/config_db.php and edit : __ Online__
  • Config::set("host", 'localhost');
  • Config::set("db_name", 'DB_NAME');
  • Config::set("user", 'USER');
  • Config::set("pass", 'PASS');
  • Config::set("port", null);

SMTP

  1. open app/config/config_mail.php and edit Online environment
  • define('mail_host','mail.mailserver.com');
  • define('mail_user','mailserveruser');
  • define('mail_pass','password');
  • define('mail_from','info@mail.com');
  • define('mail_port',25);

Run Once:

  • to make empty database.
  1. open url: http://your_url/set [To migrate database schema tables.]

  2. Next after delete file : app/_c/set.php

  3. admin area : http:\your_url\admin

  • default user: admin
  • default pass: 1234

Features:

  • MVC design pattern.
  • Multi-languages.
  • supported Automatic routing and routes rules.
  • supported Composer PHP dependencies management prs-4 class_map.
  • GUI to create controllers, models and views.
  • Model singleton style.
  • Provide A brief report about all application files status.
  • Design By: Mohammed ibrahem. ebnibrahem@gmail.com

Getstart:

M5 Framework Overview:

  • M5 framework consider MVC design pattern aproach which separate programming logic (PHP files) from user interface (HTML files) and isolate databse layer form others.

File structure:

  • app/_c : Controllers files.
  • app/_m : Models files.
  • libs : classes and functions.php
  • assets : images,js,css and fonts.
  • string : languages string. you can change from app/config/Config.php
  • upload : upload path; you can change from app/init by edit UPLOAD_DIR Constant.
  • vendor : main composer folder to all PHP dependencies and packages.

index.php

  • M5\MVC\App::play(["url" => $_GET['url'],"status" => true]);
  • status accept ture|false to show application status in bottom.

Controllers

  • all controller class file are stored in _app/c and namespace M5\Controllers. Controller class name must start with Capital Letter.
  • must create Class::index($params=[]) method in each controllers class.

share data between controllers and views

to Share data between controllers and views e.g dynamic nav pages, application information etc.

  • add all shared data in M5\MVC\Shared::boot();
  • as $data[$key].

Middleware ( Set access rule to contoller in inside (_c) directory )

  • add in app/config/config.php;

Models

  • M5 Model used concept of singleton pattern, to create instant from Model :
  • M5\MVC\Model::getInst($table_name,$show_error='',METHOD) METHOD : to seek target of an error in App;

Views

  • all views located in app/_v.
  • no view engine used you can sperate your template in: widgets/header.php, widgets/footer.php

Helper Libraies

  • M5 provide built-in classes to facilitate in achieving some routines operations e.g database schema, send email, sessions, cookies ect..
  • all classes located in libs\ directorey with namespace M5\Libray\

in libs\functions.php your found more helpers.

###.. to be contiuned .. ###

About


Languages

Language:PHP 71.8%Language:JavaScript 24.4%Language:CSS 3.8%Language:Hack 0.0%