Wrote this a while back to learn PHP and MVC, uploading here just for the backup.
⚠️ Not for productionn use.
A simple todo application build with MVC pattern and written in PHP.
- PHP 7.4
- MySQL 5.7
- Composer
git clone https://github.com/notarun/todo-php-mvc
cd todo-php-mvc
composer install # setup vendor folder for autoloading
cp config.example.php config.php # create config file
vim config.php # edit config file
mysql -u root < schema.sql # import the schema file
composer start # start the dev server (localhost:8080)
- Routes are defined in
src/routes.php
. - Dependency containers are defined in
src/containers.php
. - Validators are defined in
src/validators.php
. - Views are inside
src/views/
directory. - Controllers are inside
src/app/Controllers/
directory. - Models are inside
src/app/Models/
directory. - Middlewares can be created inside
src/app/Middlewares/
directory.