Skip to content

ribafs/php-router

Repository files navigation

Application with PHP, MVC and Routes

To simplifier I create one table, customer with only two fields, name and email.

Discussion forum for the repository

I just created a forum to exchange ideas about MVC and router in PHP

https://github.com/ribafs/php-router/discussions

Installation

See file INSTALL.md

Application created based on mini3

https://github.com/panique/mini3

Main objective

When I created this app, I wanted to go out making adaptations to use the route in other apps and get better to be able to use it in production, but it's good to resist this temptation and remember...

The main objective of this application is not to create something to be used in production, but to create a structure in PHP using MVC and routes in the sense of learning these concepts in practice to better understand and use a good PHP framework and this one to be used in production.

This repository URL

https://github.com/ribafs/php-router

How to add a new CRUD to another table

  • Add a tabela to database
  • Add the model to this table
  • Add the controller
  • Add folder to views
  • Add respective code on Core/Router.php
  • Add link to new table in App/views/templates/menu.php

Resources

  • Bootstrap 5.2
  • MVC
  • Simple route
  • Very simple and easy to understand
  • Simple and clean structure
  • Create clean and "beautiful" URLs
  • Attempts to follow PSR coding guidelines
  • Uses PDO for any database request, comes with an additional PDO debug tool to emulate your SQL statements
  • Commented code
  • Uses only native PHP code, so you don't need to learn a framework to understand MVC
  • Use autoloader from PSR-4 and composer

Exaple with automatic router

https://github.com/ribafs/phpoo-livro/tree/main/atualizacoes/php-router2

Referências sobre rotas para PHP

https://github.com/panique/mini3

https://github.com/ribafs/php-router

https://github.com/ribafs/phpoo-livro

https://github.com/ribafs/mini-mvc

https://helpincoding.com/php-routing-with-parameters/

https://github.com/yousufnoor5/php-basic-routing

Simple example router

simple-router

Routing definition

Routing.md

See my last projects similar to this one:

https://github.com/ribafs/simplest-router

https://github.com/ribafs/micro-framework

Licence

MIT license. This means that you can freely use and modify it for personal and commercial projects, only with the credit of the authors.

About

Very simples PHP router system on MVC application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages