Giter VIP home page Giter VIP logo

reims-php-2109-project2-la-petite-evasion's Introduction

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.

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_PASSWORD', 'your_db_password');
  1. Import database.sql in your SQL server, you can do it manually or use the migration.php script which will import a database.sql file.
  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

Example

An example (a basic list of items) is provided (you can load the simple-mvc.sql file in a test database). The accessible URLs are :

  • Home page at localhost:8000/
  • Items list at localhost:8000/items
  • Item details localhost:8000/items/show?id=:id
  • Item edit localhost:8000/items/edit?id=:id
  • Item add localhost:8000/items/add
  • Item deletion localhost:8000/items/delete?id=:id

You can find all these routes declared in the file src/routes.php. This is the very same file where you'll add your own new routes to the application.

How does URL routing work ?

simple_MVC.png

Ask for a tour !

Guided tour

We prepare a little guided tour to start with the simple-MVC.

To take it, you need to install the Code Tour extension for Visual Studio Code : Code Tour

It will give access to a new menu on your IDE where you'll find the different tours about the simple-MVC. Click on play to start one :

menu

reims-php-2109-project2-la-petite-evasion's People

Contributors

amandinelalle avatar kbardy avatar marvincrepin avatar mauricia-10 avatar mrocha51248 avatar rocambille avatar so-gau avatar

Stargazers

 avatar  avatar

Watchers

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