0
I’m creating an application in PHP (without frameworks) using MVC, but I’m having a lot of doubts, because until today I only used Symfony to make PHP applications. I have doubts about the routing of urls and use of functions. Here is an example of how my project is currently:
Structure:
api-system
- pub - index php.
 
- src - Controller
- Usercontroller.php
 
- Model
- User.php
 
 
- Controller
- Templates - index.html.Twig
 
File Usercontroller.php
class UserController{
    public function insertUser(){
        //execução
        return json_encode($resultado);
    }
    public function delteUser(){
        // execução
        return json_encode($resultado);
    }
}
User.php file
class User {
    public $id;
    public $name;
function getId(){
     return $this->id;
}
My questions are: How do I routing to access "api.example/insertUser" (I will have another client application that will consume this api)
(I’m using Apache’s Virtualhost, directed to /var/www/system-api/pub )
I think you should find out about PSR-4 autoloader: http://www.php-fig.org/psr/psr-4/ ( There are also other standards )
– Daniel Omine
Related: http://answall.com/questions/69178/mvc-duvida-sobre-controller-e-view-php
– Wallace Maxters
Thanks for the links!
– mauricio caserta