Giter Site home page Giter Site logo

Simple MVC

Description

This repository is a simple PHP MVC structure from scratch.

It uses some cool vendors/libraries such as Twig and Grumphp. For this one, just a simple example where users can choose one of their databases and see tables in it.

Prerequisites

Create a repository on Github in WildCodeSchool organization following this exemple : ville-session-language-project as bordeaux-0219-php-servyy

Get starter kit

  1. Clone this project
  2. Remove .git folder to remove history
  3. git init
  4. Link to your project repository you'll give to your students : git remote add origin ...
  5. Edit .travis.yml file to change default e-mails settings to get notification checking tasks end
  6. Remove trainers instructions (from Prerequisites to Configure you repository parts)
  7. git add .
  8. git commit -m "Init project repository"
  9. git push -u origin master

Check on Travis

  1. Go on https://travis-ci.com.
  2. Sign up if you don't have account,
  3. Look for your project in search bar on the left,
  4. As soon as your repository have a .travis.yml in root folder, Travis should detect it and run test.
  5. Configure Travis as described in the screenshot below, this is needed to avoid performance issues.

You can watch this screenshot to see minimum mandatory configuration : basic config

Configure you repository - Settings options

  1. Add your students team as contributor .
  2. Disallow both on 'dev' and 'master' branches your students writing credentials.
  3. Disallow merge available while one approbation is not submitted on PR.

You can watch this very tiny short video : (Loom : verrouillage branches GitHub)[https://www.loom.com/share/ad0c641d0b9447be9e40fa38a499953b]

Steps

  1. Clone the repo from Github.
  2. Run composer install.
  3. Create config/db.php from config/db.php.dist file and add your DB parameters. Don't delete the .dist file, it must be kept.
define('APP_DB_HOST', 'your_db_host');
define('APP_DB_NAME', 'your_db_name');
define('APP_DB_USER', 'your_db_user_wich_is_not_root');
define('APP_DB_PWD', 'your_db_password');
  1. Import simple-mvc.sql in your SQL server,
  2. Run the internal PHP webserver with php -S localhost:8000 -t public/. The option -t with public as parameter means your localhost will target the /public folder.
  3. Go to localhost:8000 with your favorite browser.
  4. From this starter kit, create your own web application.

Windows Users

If you develop on Windows, you should edit you git configuration to change your end of line rules with this command :

git config --global core.autocrlf true

URLs availables

  • Home page at localhost:8000/
  • Items list at localhost:8000/item/index
  • Item details localhost:8000/item/index/show/:id
  • Item edit localhost:8000/item/index/edit/:id
  • Item add localhost:8000/item/index/add
  • Item deletion localhost:8000/item/index/delete/:id

How does URL routing work ?

Simple MVC.png

Maxime Lestage's Projects

adminlte icon adminlte

AdminLTE - Free admin dashboard template based on Bootstrap 4 & 3

aksel icon aksel

Aksel illustration et tatouages

biggie icon biggie

minimalist javascript frontend framework w/ bigwheel

db_explorer icon db_explorer

Simple ruby on rails application, which help you explore your local databases. Similar like phpMyAdmin or Adminer.

dead_end icon dead_end

Searching for unexpected `end` syntax errors takes a lot of time. Let this gem do it for you!

easyrtc icon easyrtc

EasyRTC is a bundle of Open Source WebRTC joy! Our Javascript API hides the differences between Chrome and Firefox browsers and simplifies coding needed for working WebRTC apps. Signalling server using socket.io built on node.js. Tons of free code so you can build WebRTC apps in a few hours that just work. Demos include Instant messaging, Multiparty chatroom, Audio + Video, Screen sharing, Data channel Messaging and File sharing, and more.

eslint icon eslint

Find and fix problems in your JavaScript code.

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.