Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2023-10-07 (21 days ago) | | Not yet rated by the users | | Total: 54 | | All time: 10,482 This week: 106 |
|
Description | | Author |
This package can route HTTP requests to controller classes.
It can register URL path patterns to associate with controller classes.
The package can also process the current HTTP request and call the controller class that matches the first registered URL pattern.
The goal of this package is to implement a routing mechanism to present beautiful URLs.
With this mechanism, all requests are made in the public folder and then redirected to a specific file according to the route (URL) written. | |
|
|
Innovation award
Nominee: 3x
Winner: 2x |
|
Example
<?php
/**
* @autores Alf
* @copyright 2020
* @ver 1.0
*/
//echo $_SERVER['DOCUMENT_ROOT'] . _CAMINHO_CLASSES
//https://alexandrebbarbosa.wordpress.com/2019/04/19/phpconstruir-um-sistema-de-rotas-para-mvc-segunda-parte/
//echo __DIR__;
require __DIR__ . '/../config.php';
require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/../src/helpers/helper_routes.php';
//define ("_CAMINHO_TEMPLATE", "../templates/opt2/");
//define ("_CAMINHO_TEMPLATE", "../templates/opt3/");
resolve();
?>
|
Details
routes
The goal of this package is to implement a routing mechanism to present beautiful URLs. With this mechanism, all requests are made in the public folder and then redirected to a specific file according to the route (URL) written.
version
Version 1.0
2023/03/06
install
-
Copy all files to the website root.
-
Update .htaccess for the actual configuration. Change line 3 to set for the url to public folder.
edit the routes file to match a route to a file. Each route or set of routes should correspond to a website service.
In order to edit the routes.php file to make the correspondence you need to open the file and add the desired route and the corresponding service. For example, if you want to match the route "/my-route" to the "my-service" service, you can add the following line to the routes.php file:
Route::get('/my-route', 'MyService@index');
This will make it so that when a request is sent to the "/my-route" URL, the "MyService" service is invoked. You can also use route parameters and wildcards to make more complex matches. For more information on the routing system in PHP, please refer to the official documentation.
|
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.