mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
8740db9582
- Isolated Http classes from router. - Removed getInstance from Request object - current router request should now be obtained through SimpleRouter::request(). - Fixed broken test cases. - Added test for regular expression match. - Updated documentation to reflect changes. - Added more helper examples to documentation. - Added helpers to demo-project. - Optimisations.
22 lines
421 B
PHP
22 lines
421 B
PHP
<?php
|
|
namespace Demo\Controllers;
|
|
|
|
use Pecee\SimpleRouter\SimpleRouter;
|
|
|
|
class ApiController {
|
|
|
|
public function index() {
|
|
|
|
// The variable authenticated is set to true in the ApiVerification middleware class.
|
|
|
|
$request = SimpleRouter::request();
|
|
|
|
header('content-type: application/json');
|
|
|
|
echo json_encode([
|
|
'authenticated' => $request->authenticated
|
|
]);
|
|
|
|
}
|
|
|
|
} |