-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TemplateController to Spiral example application (#39)
- Loading branch information
1 parent
9c2cfb8
commit ac5c214
Showing
4 changed files
with
28 additions
and
48 deletions.
There are no files selected for viewing
46 changes: 0 additions & 46 deletions
46
examples/usages/spiral/app/src/Api/Web/Controller/HomeController.php
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
examples/usages/spiral/app/src/Api/Web/Controller/TemplateController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Api\Web\Controller; | ||
|
||
use Schranz\Templating\TemplateRenderer\TemplateRendererInterface; | ||
use Spiral\Router\Annotation\Route; | ||
|
||
class TemplateController | ||
{ | ||
public function __construct( | ||
private ?TemplateRendererInterface $defaultRenderer | ||
) { | ||
} | ||
|
||
#[Route(route: '/', name: 'index', methods: 'GET')] | ||
public function index(): string | ||
{ | ||
return | ||
'<h1>Goto /</h1>' . | ||
'<p>Default Renderer is: ' . get_debug_type($this->defaultRenderer) . '</p>' | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters