Compare commits

...

16 Commits

Author SHA1 Message Date
jay a16a554457 typos 2026-08-15 13:18:10 -04:00
jay 2b47495d60 remove space 2026-08-15 13:15:05 -04:00
jay ad53457ca2 make not static and public 2026-08-15 13:14:40 -04:00
jay 3213c0f84f make methods public 2026-08-14 18:43:38 -04:00
jay 735c111e12 change mapRoutes to protected 2026-08-14 18:39:42 -04:00
jay fdf0f55b8d correct use 2026-08-14 18:35:26 -04:00
jay ec798515d1 "psr/http-message": "^1.1.0" 2026-08-14 18:30:45 -04:00
jay 85a158c435 add Bootstrap 2026-08-14 18:16:40 -04:00
jay 83964eb9fd require twbs/bootstrap 2026-08-14 18:08:12 -04:00
jay 975ad14985 require potter/response and psr/http-message 2026-08-14 18:05:02 -04:00
jay 7942d87cbe require potter/router 2026-08-14 17:58:29 -04:00
jay 34786e7223 require potter/container 2026-08-14 17:56:52 -04:00
jay 960a6397dc delete README.md 2026-08-14 17:56:33 -04:00
jay c223b84445 require potter/controller 2026-08-14 17:55:22 -04:00
jay fcc3add34b composer init 2026-08-14 17:53:59 -04:00
jay 07bbf82d31 create .gitignore 2026-08-14 17:52:51 -04:00
4 changed files with 59 additions and 2 deletions
+3
View File
@@ -0,0 +1,3 @@
composer.lock
/nbproject/
/vendor/
-2
View File
@@ -1,2 +0,0 @@
# Bootstrap
+25
View File
@@ -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"
}
}
+31
View File
@@ -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']);
}
}