GithubHelp home page GithubHelp logo

php-simple-mvc's Introduction

#PHP/JS/MySQL Simple PHP MVC framework with example student scaffold.

Before start, you should create the table in MySQL.

CREATE TABLE Students (
         id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
         first_name VARCHAR(20) default 'Vasiliy',
         last_name VARCHAR(20) default 'Pupkin',
         sex VARCHAR(6) default 'Male',
         grp VARCHAR(10) default 'IT15-1',
         faculty VARCHAR(10) default 'FAM',
         created TIMESTAMP DEFAULT NOW()
         ) ENGINE=INNODB;

then write to the file config/config.php parameteres with access to MySQL db.

By default you do not have mod_rewrite available, the entry to the site will be the same, except that the URL will contain the values needed such as: http://www.example.com/index.php?rt=controller/action

The .htaccess file will permit access to the site via urls such as http://www.example.com/index.php/controller/action

file .htaccess

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA] 

Structure of project

├── app
│   ├── controllers
│   │   ├── default
│   │   │   └── error404.php
│   │   ├── indexController.php
│   │   └── studentController.php
│   ├── models
│   │   ├── studentActiveRecord.class.php
│   │   ├── studentEntity.class.php
│   │   └── studentModel.class.php
│   └── views
│       ├── defFooter.php
│       ├── defHeader.php
│       ├── error404.php
│       ├── index.php
│       ├── studentEdit.php
│       ├── studentList.php
│       ├── studentNew.php
│       └── studentPartForm.php
├── config
│   ├── config.php
│   └── schema.txt
├── index.php
├── lib
│   ├── active_record_base.class.php
│   ├── controller_base.class.php
│   ├── db.class.php
│   ├── includes
│   │   └── init.php
│   ├── registry.class.php
│   ├── request.class.php
│   ├── router.class.php
│   └── template.class.php
└── public
    ├── scripts
    │   ├── jquery.js
    │   └── jquery.ujs.js
    └── styles
        └── main.css

The main script is /index.php, then it includes file /lib/includes/init.php. The base classes is in folder /lib. Controllers in folder /app/controllers. Models in folder /app/models. Views in folder /app/view. Static files in folder /public.

php-simple-mvc's People

Stargazers

BLBurns avatar

Watchers

Dmitry Ben 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.