mohakhlf / hackathonCKMS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Use this template repository to a new Github repository in WildCodeSchool organization following this exemple : <campus>-<langage>-<YYMM>-<type>-<name> as bordeaux-php-1903-project2-servyy

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

About


Languages

Language:HTML 56.1%Language:PHP 34.6%Language:TSQL 4.0%Language:CSS 3.0%Language:JavaScript 2.2%