Compare commits
16 Commits
30cb4edfa6
..
0.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| a16a554457 | |||
| 2b47495d60 | |||
| ad53457ca2 | |||
| 3213c0f84f | |||
| 735c111e12 | |||
| fdf0f55b8d | |||
| ec798515d1 | |||
| 85a158c435 | |||
| 83964eb9fd | |||
| 975ad14985 | |||
| 7942d87cbe | |||
| 34786e7223 | |||
| 960a6397dc | |||
| c223b84445 | |||
| fcc3add34b | |||
| 07bbf82d31 |
@@ -0,0 +1,3 @@
|
|||||||
|
composer.lock
|
||||||
|
/nbproject/
|
||||||
|
/vendor/
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "potter/bootstrap",
|
||||||
|
"type": "library",
|
||||||
|
"license": "MIT",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Potter\\": "src/Potter/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jay Potter",
|
||||||
|
"email": "j@ypotter.ca"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"require": {
|
||||||
|
"potter/container": ">=0.0.1",
|
||||||
|
"potter/controller": ">=0.0.1",
|
||||||
|
"potter/response": ">=0.0.1",
|
||||||
|
"potter/router": ">=0.0.1",
|
||||||
|
"psr/http-message": "^1.1.0",
|
||||||
|
"twbs/bootstrap": "^5.3.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Potter;
|
||||||
|
|
||||||
|
use \Potter\Response\Text;
|
||||||
|
use \Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
|
||||||
|
|
||||||
|
final class Bootstrap extends Controller
|
||||||
|
{
|
||||||
|
public function getBootstrapScript(ServerRequestInterface $request): ResponseInterface
|
||||||
|
{
|
||||||
|
return new Text(
|
||||||
|
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/js/bootstrap.js'),
|
||||||
|
headers: ['Content-Type' => ['application/javascript; charset=utf-8']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBootstrapStyle(ServerRequestInterface $request): ResponseInterface
|
||||||
|
{
|
||||||
|
return new Text(
|
||||||
|
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/css/bootstrap.css'),
|
||||||
|
headers: ['Content-Type' => ['text/css; charset=utf-8']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function mapRoutes(Container $container, \Potter\Router\Router $router): void
|
||||||
|
{
|
||||||
|
$router->map('GET', '/bootstrap.js', [$this, 'getBootstrapScript']);
|
||||||
|
$router->map('GET', '/bootstrap.css', [$this, 'getBootstrapStyle']);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user