Download the PHP package raoul/mvc-framework without Composer
On this page you can find all versions of the php package raoul/mvc-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mvc-framework
About my mvc Framework
How to install
Clone repository
Install composer packages
Running the framework
To run the framework you have 2 options: Run it from command line
or run it by creating a virtual host.
Note that mvc server uses the PHP server under the hood which is NOT meant to used as a web server so only use mvc serve
for development purposes!
And make sure you are running your database if you want to use it
Routing
Go to the web.php file in the routes folder
Route parameters
Grouped routes
Middleware
Middleware is used to validate the uri request
Creating middleware
To create middleware execute the following command:
Adding middleware to a route
Adding middleware to a single route
Adding middleware to grouped routes
To specify new middleware to go app\Http\HttpKernel and add youre middleware class to
Controllers
A controller is used to communicate between a view and a model
Creating a controller
You can create a controller by using the following command:
Routing in a controller
Rendering a view
Models
A model is used to interact with the database
Creating a Model
You can create a model by using the following command:
The name you give to the model wil also be parsed to the name of your database table for example:
will by default have users as table name
You can change the name of databaseTable by adding
Model properties
Below a list of properties that you can change
Model Query Builder
This model also has a query builder wich you can use example below
If you dont want to use the query builder you can also execute sql statements by using:
At the end of every builded query you need to use
to execute the sql statement
Requests
In this framework you can use a request class to validate the request data before it gets to the controller and redirects the user back to the previous page with a errors
Creating a request class
To create a request class use the following command
Specifying the rules
To validate the data you need to use the rules()
function as following:
You can also specify what url the request is gona redirect to if it has failed
using authorize()
U can use the authorize function to validate if a user is allowed to make the request
if authorize()
doesnt return true it will throw en error
All versions of mvc-framework with dependencies
vlucas/phpdotenv Version ^5.5
psr/http-message Version ^1.0
psr/container Version ^2.0
twig/twig Version ^3.5
psr/http-server-middleware Version ^1.0
raoul/php-validator Version ^1.0