Added app and PHP version displays to the footer
This commit is contained in:
26
src/Middleware/AppInfo.php
Normal file
26
src/Middleware/AppInfo.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace BitGoblin\Colossus\Middleware;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class AppInfo {
|
||||
|
||||
protected $view;
|
||||
|
||||
public function __construct($view) {
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
public function __invoke(Request $request, $handler) {
|
||||
// add running app version
|
||||
$composer = json_decode(file_get_contents(__DIR__ . '/../../composer.json'), true);
|
||||
$this->view->getEnvironment()->addGlobal('APP_VERSION', $composer['version'] ?? 'unknown');
|
||||
|
||||
// add running PHP version
|
||||
$this->view->getEnvironment()->addGlobal('PHP_VERSION', PHP_VERSION);
|
||||
|
||||
return $handler->handle($request);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user