Skip to content

Commit fe3d5e8

Browse files
committed
Feat: Worked on Api v1.2.0,
- Worked on src/web.php to register api route class controller - Worked on routes/api.php to register new Api route - Created ApiController to which handles Api routings With controller for Api routings
1 parent 0bcd478 commit fe3d5e8

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed
File renamed without changes.

Controller/UserController.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace PhpSlides\Controller;
4+
5+
/**
6+
* Example of Web Route controller class
7+
*/
8+
final class UserController extends Controller
9+
{
10+
public function __invoke()
11+
{
12+
return "Invoked & get all users successful.";
13+
}
14+
15+
public function User(string $user_name)
16+
{
17+
return "User ID = $user_name";
18+
}
19+
}

routes/api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
use PhpSlides\Api;
44

55
Api::get("/api/posts");
6-
Api::post("/api/posts/{id}", @Post);
6+
Api::post("/api/posts/{id}", @Post);

0 commit comments

Comments
 (0)