-
Notifications
You must be signed in to change notification settings - Fork 23
/
Api.php
39 lines (34 loc) 路 893 Bytes
/
Api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
/*
* This file is part of the your app package.
*
* The PHP Application For Code Poem For You.
* (c) 2018-2099 http://yourdomian.com All rights reserved.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\App\Controller\Api;
/**
* @codeCoverageIgnore
*/
class Api
{
#[Route(
path: "/api/v1/demo/{name:[A-Za-z]+}/",
attributes: ["args1" => "hello", "args2" => "world"],
)]
public function demo1(string $name): string
{
return sprintf('Hi you, you name is %s in version 1', $name);
}
#[Route(
path: "/api/v2/demo/{name:[A-Za-z]+}/",
middlewares: "api",
)]
public function demo2(string $name): string
{
return sprintf('Hi you,your name is %s in version 2', $name);
}
}