A very clean and maintainable MVC CRUD application built with PHP 8.3+, running on Apache with MySQL database and PHPMyAdmin5.
- MVC Architecture
- PHP 8.3+ with modern features
- Docker development environment
- Clean and maintainable code structure
- MySQL database with phpMyAdmin
- Basic CRUD operations
.
├── config/ # Configuration files
│ ├── bootstrap.php # Application bootstrap
│ └── routes.php # Route definitions
├── database/ # Database scripts
│ └── migrate.php # Database migration script
├── public/ # Public directory
│ ├── .htaccess # URL rewriting for Apache
│ └── index.php # Application entry point
├── src/ # Application source code
│ ├── Controllers/ # Controller classes
│ ├── Core/ # Framework core classes
│ ├── Exceptions/ # Custom exceptions
│ ├── Models/ # Model classes
│ └── Views/ # View templates
├── .env.example # Environment template
├── .gitignore # Git ignore file
├── Dockerfile # Docker configuration
├── apache-config.conf # Apache configuration
├── composer.json # Composer dependencies
└── docker-compose.yml # Docker compose configuration
- Docker and Docker Compose
- Git (optional)
- Clone the repository (or download and extract the zip file):
git clone https://github.com/Retro-Artist/Docker-Studies.git
cd htdocs- Simply rename ".env.example" to ".env" or create a new .env file using ".env.example" as a template:
docker-compose mv .env.example .env- Start the Docker containers:
docker-compose up -d- Install Composer dependencies:
docker-compose exec app composer install- Run the database migration script:
docker-compose exec app php database/migrate.php- Access the application in your browser:
- Application: http://localhost:8080
- phpMyAdmin: http://localhost:8081 (Server: mysql, Username: root, Password: root_password)
The Docker environment maps the src directory from your local machine to the container, so any changes you make to the files will be immediately reflected in the application.
- Make changes to the code on your local machine.
- Refresh the browser to see the changes.
- Use phpMyAdmin to manage the database if needed.
- Host: localhost
- Port: 3306
- Database: mvc_crud
- Username: root
- Password: root_password
For phpMyAdmin:
- URL: http://localhost:8081
- Server: mysql
- Username: root
- Password: root_password
To deploy to a Linux production server:
- Clone the repository on the server.
- Configure your production Apache server to point to the
publicdirectory. - Set up the MySQL database and update the
.envfile with the production credentials. - Install Composer dependencies with
composer install --no-dev. - Run the database migration script.
This project is open-sourced software licensed under the MIT license.