PHP using MVC

0

I'm creating a PHP application (without frameworks) using MVC, but I have a lot of doubts, because until today I only used Symfony to make PHP applications. I have questions about urls routing and use of functions. Here's an example of how my project is currently:

Structure:

system-api

  • pub

    • index.php
  • src

    • Controller
      • UserController.php
    • Model
      • User.php
  • Templates

    • index.html.twig

UserController.php file

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 route 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)

    
asked by anonymous 26.08.2015 / 16:42

0 answers