fernandopetry / mvc
Manage mvc calls
Installs: 4 759
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: ~5.0
This package is not auto-updated.
Last update: 2025-01-30 21:14:02 UTC
README
Exemplo de htaccess
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?router=/$1 [QSA,L] </IfModule>
Usage 1
<?php use \Petry\MVC\Uri\Parse; use \Petry\MVC\Uri\Param; use \Petry\MVC\Uri\GetByURI; $uri = new GetByURI('router'); $param = new Param($uri); $parse = new Parse($param); $parse->getController(); // Controller $parse->getAction(); // Action $parse->getParams(); // Params
Usage 2 | Facade
<?php use \Petry\MVC\Uri\UriFacade; $facade = new UriFacade('router'); $facade->getController(); // Controller $facade->getAction(); // Action $facade->getParams(); // Params
Install composer
$ composer require fernandopetry/mvc
Usage ControllerFactory
<?php use \Petry\MVC\Uri\UriFacade; try { $factory = new \Petry\MVC\Controller\ControllerFactory(new UriFacade('router'),'Petry\Test\Controller'); $factory->factory(); }catch (Exception $e){ echo $e->getMessage(); }