Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2024-04-20 (5 months ago) | | Not enough user ratings | | Total: 120 This week: 3 | | All time: 9,502 This week: 12 |
|
Description | | Author |
This package provides an example application using an MVC framework.
It provides a PHP applications built using controller, service and middleware classes that use framework classes that help using the MVC design pattern.
Currently, the framework provides the following classes:
- A base controller
- Request handler
- Request dispatcher
- Error handler
- Middleware request handler
- Migration
- Model
- Request
- Request
- Router | |
|
|
Innovation award
Nominee: 5x
Winner: 1x |
|
Example
<?php
declare(strict_types=1);
define("ROOT_PATH", dirname(__DIR__));
require ROOT_PATH . "/vendor/autoload.php";
$dotenv = Dotenv\Dotenv::createImmutable(ROOT_PATH);
$dotenv->load();
set_error_handler("Framework\ErrorHandler::handleError");
set_exception_handler("Framework\ErrorHandler::handleException");
$router = require ROOT_PATH . "/config/routes.php";
$container = require ROOT_PATH . "/config/services.php";
$middleware = require ROOT_PATH . "/config/middleware.php";
$dispatcher = new Framework\Dispatcher($router, $container, $middleware);
$request = Framework\Request::createFromGlobals();
$response = $dispatcher->handle($request);
$response->send();
|
Details
Welcome to the PHP MVC Framework
This is a simple MVC framework for building web applications in PHP. It's free and open-source.
It was created for the Write PHP Like a Pro: Build an MVC Framework from Scratch course.
That course explains how the framework is put together, building it step-by-step, from scratch. If you've taken the course, then you'll already know how to use it.
If not, please look at the example code in the config and src/App folders for examples of how to use it.
DISCLAIMER
This framework was developed as a teaching example on the aforementioned course. The idea is that by developing this framework on that course, you'll understand how frameworks like Laravel work. No warranty is provided. For more details please see the licence.
Starting an Application using this Framework
-
First, download the framework, either directly or by cloning the repo.
-
Configure your web server to have the public folder as the web root.
-
Make a copy of the .env.example file and call it .env, and enter your database configuration data.
-
Create routes, controllers, views, models, middleware etc.
Build This Framework From Scratch
Signup for the course here and understand how this framework is built from scratch, putting it all together step by step.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.