Skip to content

Commit 3a2bd54

Browse files
committed
add basic controller
1 parent b677305 commit 3a2bd54

File tree

4 files changed

+86
-3
lines changed

4 files changed

+86
-3
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
"php": ">=8.1",
88
"ext-ctype": "*",
99
"ext-iconv": "*",
10+
"fig/http-message-util": "^1.1",
1011
"symfony/console": "6.3.*",
1112
"symfony/dotenv": "6.3.*",
1213
"symfony/flex": "^2",
1314
"symfony/framework-bundle": "6.3.*",
1415
"symfony/runtime": "6.3.*",
1516
"symfony/yaml": "6.3.*"
1617
},
17-
"require-dev": {
18-
},
1918
"config": {
2019
"allow-plugins": {
2120
"php-http/discovery": true,

composer.lock

Lines changed: 57 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Controller/.gitignore

Whitespace-only changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Controller;
6+
7+
use DateTimeImmutable;
8+
use Fig\Http\Message\RequestMethodInterface;
9+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
10+
use Symfony\Component\HttpFoundation\JsonResponse;
11+
use Symfony\Component\HttpFoundation\Request;
12+
use Symfony\Component\Routing\Annotation\Route;
13+
14+
class TransactionController extends AbstractController
15+
{
16+
#[Route(
17+
'/api/transactions',
18+
name: 'app_api_create_transaction',
19+
methods: [RequestMethodInterface::METHOD_POST],
20+
)]
21+
public function create(Request $request): JsonResponse
22+
{
23+
return $this->json([
24+
'data' => 'ok',
25+
'datetime' => (new DateTimeImmutable('now'))->format('Y-m-d H:i:s'),
26+
]);
27+
}
28+
}

0 commit comments

Comments
 (0)