Skip to content

Commit

Permalink
Merge pull request #1 from designcise/4.x
Browse files Browse the repository at this point in the history
feat: updated PHP version to 8.2
  • Loading branch information
designcise authored Jul 1, 2023
2 parents 7deee81 + fbfc8db commit 445f966
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
.gitignore
LICENSE
README.md
CHANGELOG.md
CHANGELOG.md
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ vendor
.idea
.DS_Store
*.cache
composer.lock
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ RUN composer install \
--optimize-autoloader \
--prefer-dist

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

RUN apt-get update \
&& apt-get install -y --fix-missing curl git vim wget netcat chrpath git unzip zip \
&& apt-get install -y --fix-missing curl git vim wget chrpath git unzip zip \
&& usermod -u 1000 www-data \
&& usermod -G staff www-data \
&& chown -R www-data:www-data /var/www \
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# License

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

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:

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Simply clone the repo and start building your projects.

### Prerequisites:

- BitFrame v3.6
- PHP 8.1+
- Nginx
- BitFrame v4.0
- PHP 8.2+
- Nginx (or Apache)
- Docker Engine 1.13.0+

## Directory Structure
Expand Down
10 changes: 5 additions & 5 deletions www/composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"require": {
"php": ">=8.1",
"designcise/bitframe": "^3.6",
"designcise/bitframe-fastroute": "^3.6",
"designcise/bitframe-whoops": "^3.6",
"nyholm/psr7": "^1.4"
"php": ">=8.2",
"designcise/bitframe": "^4.0",
"designcise/bitframe-fastroute": "^4.0",
"designcise/bitframe-whoops": "^4.0",
"nyholm/psr7": "^1.8.0"
},
"require-dev": {
"roave/security-advisories": "dev-master",
Expand Down
25 changes: 22 additions & 3 deletions www/server/app/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,40 @@
use Psr\Http\Message\{ServerRequestInterface, ResponseInterface};
use Psr\Http\Server\RequestHandlerInterface;
use BitFrame\Container;
use BitFrame\FastRoute\Route;
use BitFrame\Http\Message\JsonResponse;

class DefaultController
{
public function testAction(
public function __construct(
private readonly Container $container,
) {}

#[Route(['GET'], '/hello/{action}')]
public function indexAction(
ServerRequestInterface $request,
RequestHandlerInterface $handler,
Container $container
): ResponseInterface {
$response = $handler->handle($request);
$globals = $container['globals'];
$globals = $this->container['globals'];

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

return $response;
}

#[Route(['GET'], '/json')]
public function jsonAction(): ResponseInterface
{
$globals = $this->container['globals'];

return JsonResponse::create([
'data' => [
'title' => $globals['title'],
'mainHeading' => 'Build Something Amazing Today!',
],
]);
}
}
4 changes: 3 additions & 1 deletion www/server/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
use YourProject\App\Controller\DefaultController;

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

0 comments on commit 445f966

Please sign in to comment.