Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.idea/
/src/log/
/src/temp/
/src/vendor/
/src/vendor/
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
.PHONE composerValidate:
composerValidate:
cd ./src && composer validate --strict


.PHONE dockerComposeUp:
dockerComposeUp:
docker compose -p wb_assignment up -d

.PHONE phpstan:
phpstan:
cd ./src && composer phpstan
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
api:
build:
dockerfile: ./docker/DockerfilePhp
ports:
- 8090:80
volumes:
- ./docker/apache.conf:/etc/apache2/sites-available/000-default.conf
- ./src:/var/www/html
depends_on:
- database

database:
image: mariadb:10.4
container_name: database
environment: # Accepted security risk for sake of development speed
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: mydb
MYSQL_USER: myuser
MYSQL_PASSWORD: mypass
ports:
- "3306:3306"
13 changes: 13 additions & 0 deletions docker/DockerfilePhp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM php:8.3-apache

RUN apt-get update -y

RUN apt-get install -y libicu-dev

RUN docker-php-ext-install intl

RUN docker-php-ext-install mysqli

RUN a2enmod rewrite

RUN service apache2 restart
7 changes: 7 additions & 0 deletions docker/apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/www

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
2 changes: 1 addition & 1 deletion src/app/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace App;
namespace WbAssignment;

use Nette;
use Nette\Bootstrap\Configurator;
Expand Down
2 changes: 1 addition & 1 deletion src/app/Core/RouterFactory.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace App\Core;
namespace WbAssignment\Core;

use Nette;
use Nette\Application\Routers\RouteList;
Expand Down
2 changes: 1 addition & 1 deletion src/app/Presentation/Accessory/LatteExtension.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace App\Presentation\Accessory;
namespace WbAssignment\Presentation\Accessory;

use Latte\Extension;

Expand Down
2 changes: 1 addition & 1 deletion src/app/Presentation/Error/Error4xx/Error4xxPresenter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace App\Presentation\Error\Error4xx;
namespace WbAssignment\Presentation\Error\Error4xx;

use Nette;
use Nette\Application\Attributes\Requires;
Expand Down
2 changes: 1 addition & 1 deletion src/app/Presentation/Error/Error5xx/Error5xxPresenter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace App\Presentation\Error\Error5xx;
namespace WbAssignment\Presentation\Error\Error5xx;

use Nette;
use Nette\Application\Attributes\Requires;
Expand Down
2 changes: 1 addition & 1 deletion src/app/Presentation/Home/HomePresenter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace App\Presentation\Home;
namespace WbAssignment\Presentation\Home;

use Nette;

Expand Down
6 changes: 4 additions & 2 deletions src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"license": ["MIT", "BSD-3-Clause", "GPL-2.0-only", "GPL-3.0-only"],
"require": {
"php": ">= 8.3",
"dibi/dibi": "^5.1",
"latte/latte": "^3.0",
"nette/application": "^3.2.3",
"nette/assets": "^1.0.0",
"nette/bootstrap": "^3.2.6",
Expand All @@ -17,7 +19,6 @@
"nette/robot-loader": "^4.0",
"nette/security": "^3.2",
"nette/utils": "^4.0",
"latte/latte": "^3.0",
"tracy/tracy": "^2.10"
},
"require-dev": {
Expand All @@ -31,11 +32,12 @@
},
"autoload": {
"psr-4": {
"App\\": "app"
"WbAssignment\\": "app"
}
},
"scripts": {
"phpstan": "phpstan analyse -c ../phpstan.neon",
"server": "cd ./www && php -S localhost:8005",
"tester": "tester tests -s"
},
"minimum-stability": "stable",
Expand Down
76 changes: 75 additions & 1 deletion src/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions src/config/common.neon
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# see https://doc.nette.org/en/configuring

parameters:
dibi: # Accepted security risk for sake of development speed
host: database
port: 3306
database: mydb
user: myuser
password: mypass
lazy: TRUE


application:
errorPresenter:
4xx: Error:Error4xx
5xx: Error:Error5xx
mapping: App\Presentation\*\**Presenter
mapping: WbAssignment\Presentation\*\**Presenter


database:
Expand All @@ -20,7 +27,7 @@ latte:
strictTypes: yes
strictParsing: yes
extensions:
- App\Presentation\Accessory\LatteExtension
- WbAssignment\Presentation\Accessory\LatteExtension


assets:
Expand All @@ -34,3 +41,10 @@ di:
export:
parameters: no
tags: no


dibi: %dibi%


extensions:
dibi: Dibi\Bridges\Nette\DibiExtension22
2 changes: 1 addition & 1 deletion src/config/services.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services:
- App\Core\RouterFactory::createRouter
- WbAssignment\Core\RouterFactory::createRouter


search:
Expand Down
2 changes: 1 addition & 1 deletion src/www/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require __DIR__ . '/../vendor/autoload.php';

$bootstrap = new App\Bootstrap;
$bootstrap = new WbAssignment\Bootstrap;
$container = $bootstrap->bootWebApplication();
$application = $container->getByType(Nette\Application\Application::class);
$application->run();