GithubHelp home page GithubHelp logo

amandb76 / php-mvc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crjoseabraham/php-mvc

0.0 0.0 0.0 38 KB

Vanilla PHP ready to use MVC structure with router and database class

JavaScript 0.19% PHP 99.33% CSS 0.48%

php-mvc's Introduction

Pure PHP Ready to use MVC structure

This is a personal project I made to teach myself how MVC works so I can use it for future projects. I did it by taking portions of code from different PHP courses I took (see Acknowledgements below). Some of the topics I learnt by doing this:

  • MVC pattern and OOP
  • WTH is a Router and how does that work?
  • How to use regular expressions
  • Handling databases with PDO

Installation

  1. Download as .zip or clone this repo using
    git clone https://github.com/crjoseabraham/php-mvc.git
  2. Import the data/todo_db.sql file to phpMyAdmin
  3. Install composer
    https://getcomposer.org/download/
  4. Run composer install
  5. Start your Apache server and go to http://localhost/php-basic-mvc

You're done :)

Project structure

As most MVC frameworks, this project flows through public/index.php and loads the correspondant page base on the URL

php-mvc/
    config/             # Database credentials, utility functions, constants used frequently
    data/               # SQL database file
    public/             # Accessible files. What final users see
        css/            # Compiled css file
        js/             # Compiled javascript file
        index.php       # Starting point for the entire app
    src/                # Application source code
        app/            # Router class, routes.php
        controllers/    # Controller classes
        models/         # Model classes
        views/          # Views
        .htaccess       # Make src/ unaccessible for users
    vendor/             # Composer files, autoloader !ignored
    .gitignore          # Files/folders to be ignored by version control
    .htaccess           # Redirect everything to public/ folder
    composer.json       # Composer dependency file

Acknowledgements

I did this by making a combination of what I learnt from some online PHP courses I took

php-mvc's People

Contributors

crjoseabraham 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.