1. Go to this page and download the library: Download mitsuki/controller library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mitsuki / controller example snippets
use Mitsuki\Controller\BaseController;
class UserController extends BaseController
{
public function index()
{
return $this->response('<h1>Hello World</h1>');
}
public function api()
{
return $this->json(['status' => 'ok']);
}
}
use Mitsuki\Controller\Resolvers\ControllerResolver;
$resolver = new ControllerResolver(__DIR__ . '/src');
$controllers = $resolver->resolve();
#[Controller('/admin')]
class AdminController {}
class BlogController {
#[Route('blog_index', '/blog', ['GET'])]
public function index() {}
}