Skip to content

Commit

Permalink
Adds method to get current app version (#65)
Browse files Browse the repository at this point in the history
#50
  • Loading branch information
butschster committed Aug 7, 2023
1 parent bf58a21 commit b259479
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/src/Interfaces/Http/GetVersionAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace App\Interfaces\Http;

use App\Application\HTTP\Response\JsonResource;
use App\Application\HTTP\Response\ResourceInterface;
use Spiral\Boot\EnvironmentInterface;
use Spiral\Router\Annotation\Route;

final class GetVersionAction
{
#[Route(route: 'version', methods: ['GET'], group: 'api')]
public function __invoke(EnvironmentInterface $env): ResourceInterface
{
return new JsonResource([
'version' => $env->get('APP_VERSION', 'dev'),
]);
}
}

0 comments on commit b259479

Please sign in to comment.