Skip to content

Latest commit

 

History

History
51 lines (42 loc) · 2.63 KB

README.md

File metadata and controls

51 lines (42 loc) · 2.63 KB

PHP-MVC SKELETON

A PHP OOP web application skeleton that uses MVC architectural pattern to create a basic application that contains login and multi language systems and can be used in any web project.

  • It was created to get rid of the trouble of creating a MVC script from scratch

Description

Basic php skeleton of an MVC (model-view-controller) web application that you can use to build your application upon it or to understand the MVC pattern.

Features

  1. MVC based application
  2. MYSQL database connection
  3. multi language
  4. login system
  5. session store and recovery

How it works

It's a normal MVC application so it consists of models/views/controllers

  1. First it runs the initiation script init.php
    • The initiation script loads main scripts and confinguration files.
  2. Then a new app instance is created and the url is parsed in the App.php class
  3. In App.php class the requested language is set and the requested controller is loaded ex: home.php controller.
  4. A controller class instance is created and the requested method called
  5. The method calls the model method and in the model loading method we check for login Controller model
    • If the user is loggedin it'll get the requested model, else it'll redirect to login
  6. The controller method then calls the view method and in the view loading method we load the language files and the page layout. Controller view

Directory structure

  1. app: Application backend

    • config: configuration files
    • core: core scripts called in app initiation
    • Helper: helper function such as common used and database functions
    • languages: languages contain directories with language code
    • controllers: application controllers
    • models: application models
    • views: application views
    • init.php: initiation script that includes necessary scripts.
    • .htaccess: htaccess file to prevent entering this area for users
  2. public

    • index.php: creates an app instance.
    • .htaccess: htaccess to control the url writing
    • css: contains css style files.
    • js: contains javascript files.

How to use it

  • Just clone the repo and start building upon the provided skeleton

Finally

I'll be pleased to see contribution send a pull request, if you have any questio you can open an issue.