-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVersionController.php
More file actions
32 lines (25 loc) · 816 Bytes
/
Copy pathVersionController.php
File metadata and controls
32 lines (25 loc) · 816 Bytes
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
<?php
declare(strict_types=1);
namespace Dltn\Http\Controllers\Api;
use Dltn\Core\Config;
use Dltn\Http\Controller;
use Dltn\Http\Request;
use Dltn\Http\Response;
/** Framework / app version metadata. */
final class VersionController extends Controller
{
public function show(Request $request, array $params = []): Response
{
$config = $this->container->get(Config::class);
$payload = [
'name' => (string) $config->get('app_name', 'DLTN Framework'),
'version' => defined('DLTN_VERSION') ? (string) DLTN_VERSION : '0.0.0',
'php' => PHP_VERSION,
];
$filtered = apply_filters('api.version', $payload);
if (!is_array($filtered)) {
$filtered = $payload;
}
return $this->json($filtered);
}
}