This is a PHP project that implements an MVC (Model-View-Controller) architecture similar to Laravel framework.
This is the entry point of the application. It includes the necessary files, registers the autoloader, and calls the appropriate controller action based on the request.
This folder contains the application code organized into separate directories for models, views, and controllers.
This folder contains the model classes, each extending the abstract Model class. These models have the basic CRUD operations implemented using the PDO database library.
To create a new model, create a new file in the Models directory and extend the Model class. Be sure to set the $tableName property to the name of the database table that the model represents.
This folder contains the views (HTML templates) that are rendered by the controller actions. Each view corresponds to a specific controller action.
This folder contains the controller classes. These classes handle the user input and decide which view to render based on that input. Each controller action corresponds to a specific URL route.
To create a new model, follow these steps:
- Create a new PHP file in the App/Models directory.
- Define a new class that extends the Model class.
- Set the $tableName property to the name of the database table that the model represents.
- Define any additional methods necessary for your specific use case.
Here's an example of what a simple Post model might look like:
<?php
namespace App\Models;
use App\Model;
class Post extends Model
{
protected static $tableName = 'posts';
// Add any additional methods here
}
The goal of this project is to provide a basic MVC structure for PHP applications, similar to the popular Laravel framework. This structure can be used as a starting point for building more complex web applications, with additional models, views, and controllers.