Skip to content

Commit 445f966

Browse files
authored
Merge pull request #1 from designcise/4.x
feat: updated PHP version to 8.2
2 parents 7deee81 + fbfc8db commit 445f966

File tree

8 files changed

+37
-17
lines changed

8 files changed

+37
-17
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
.gitignore
33
LICENSE
44
README.md
5-
CHANGELOG.md
5+
CHANGELOG.md

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ vendor
22
.idea
33
.DS_Store
44
*.cache
5-
composer.lock

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ RUN composer install \
1111
--optimize-autoloader \
1212
--prefer-dist
1313

14-
FROM php:8.1.1-fpm AS base
14+
FROM php:8.2-fpm AS base
1515
COPY --from=vendor /usr/bin/composer /usr/bin/composer
1616

1717
RUN apt-get update \
18-
&& apt-get install -y --fix-missing curl git vim wget netcat chrpath git unzip zip \
18+
&& apt-get install -y --fix-missing curl git vim wget chrpath git unzip zip \
1919
&& usermod -u 1000 www-data \
2020
&& usermod -G staff www-data \
2121
&& chown -R www-data:www-data /var/www \

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# License
22

3-
### Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
3+
### Copyright (c) 2017-2023 Daniyal Hamid (https://designcise.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Simply clone the repo and start building your projects.
66

77
### Prerequisites:
88

9-
- BitFrame v3.6
10-
- PHP 8.1+
11-
- Nginx
9+
- BitFrame v4.0
10+
- PHP 8.2+
11+
- Nginx (or Apache)
1212
- Docker Engine 1.13.0+
1313

1414
## Directory Structure

www/composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"require": {
3-
"php": ">=8.1",
4-
"designcise/bitframe": "^3.6",
5-
"designcise/bitframe-fastroute": "^3.6",
6-
"designcise/bitframe-whoops": "^3.6",
7-
"nyholm/psr7": "^1.4"
3+
"php": ">=8.2",
4+
"designcise/bitframe": "^4.0",
5+
"designcise/bitframe-fastroute": "^4.0",
6+
"designcise/bitframe-whoops": "^4.0",
7+
"nyholm/psr7": "^1.8.0"
88
},
99
"require-dev": {
1010
"roave/security-advisories": "dev-master",

www/server/app/Controller/DefaultController.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,40 @@
77
use Psr\Http\Message\{ServerRequestInterface, ResponseInterface};
88
use Psr\Http\Server\RequestHandlerInterface;
99
use BitFrame\Container;
10+
use BitFrame\FastRoute\Route;
11+
use BitFrame\Http\Message\JsonResponse;
1012

1113
class DefaultController
1214
{
13-
public function testAction(
15+
public function __construct(
16+
private readonly Container $container,
17+
) {}
18+
19+
#[Route(['GET'], '/hello/{action}')]
20+
public function indexAction(
1421
ServerRequestInterface $request,
1522
RequestHandlerInterface $handler,
16-
Container $container
1723
): ResponseInterface {
1824
$response = $handler->handle($request);
19-
$globals = $container['globals'];
25+
$globals = $this->container['globals'];
2026

2127
$response->getBody()->write(
2228
"{$globals['title']} - 👋 Build Something Amazing Today!"
2329
);
2430

2531
return $response;
2632
}
33+
34+
#[Route(['GET'], '/json')]
35+
public function jsonAction(): ResponseInterface
36+
{
37+
$globals = $this->container['globals'];
38+
39+
return JsonResponse::create([
40+
'data' => [
41+
'title' => $globals['title'],
42+
'mainHeading' => 'Build Something Amazing Today!',
43+
],
44+
]);
45+
}
2746
}

www/server/config/routes.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77
use YourProject\App\Controller\DefaultController;
88

99
return static function (AbstractRouter $router, Container $container) {
10-
$router->get('/hello/{action}', [DefaultController::class, 'testAction', $container]);
10+
$router->registerControllers([
11+
new DefaultController($container),
12+
]);
1113
};

0 commit comments

Comments
 (0)