Code Monkey home page Code Monkey logo

php-mvc-skeleton's Introduction

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.

php-mvc-skeleton's People

Contributors

ahegazy avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.