Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Saloň committed Jul 3, 2024
0 parents commit cd3a33c
Show file tree
Hide file tree
Showing 148 changed files with 12,190 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .build/phpstan-doctrine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php declare(strict_types = 1);

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

return App\Bootstrap::boot()
->createContainer()
->getByType(Doctrine\ORM\EntityManagerInterface::class);
8 changes: 8 additions & 0 deletions .deployignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.build/
.docker/
.docs/
.github/
tests/
.phpstorm.meta.php
docker-compose.yml
phpstan.neon
5 changes: 5 additions & 0 deletions .docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nginx:alpine
COPY ./ /var/www/html/
CMD ["nginx"]

EXPOSE 80 443
3 changes: 3 additions & 0 deletions .docker/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
upstream php-upstream {
server php:9000;
}
24 changes: 24 additions & 0 deletions .docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
user nginx;
worker_processes 4;
daemon off;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

access_log /dev/stdout;
error_log /dev/stderr;

sendfile on;
keepalive_timeout 65;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-available/*.conf;
}
28 changes: 28 additions & 0 deletions .docker/nginx/sites/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
server {

listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

server_name localhost;
root /var/www/html/www/;
index index.php;

location / {
try_files $uri $uri/ /index.php$is_args$args;
}

location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 600;
include fastcgi_params;
}

location ~ /\.ht {
deny all;
}
}
9 changes: 9 additions & 0 deletions .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM thecodingmachine/php:8.0-v4-fpm

COPY ./ /var/www/html/

WORKDIR /var/www/html/

CMD ["php-fpm"]

EXPOSE 9000
Binary file added .docs/assets/screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .docs/assets/screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .docs/assets/screenshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .docs/assets/screenshot4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = tab
tab_width = 4

[{*.json, *.yaml, *.yml, *.md}]
indent_style = space
indent_size = 2
10 changes: 10 additions & 0 deletions .github/.kodiak.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = 1

[merge]
automerge_label = "automerge"
blacklist_title_regex = "^WIP.*"
blacklist_labels = ["WIP"]
method = "rebase"
delete_branch_on_merge = true
notify_on_conflict = true
optimistic_updates = false
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
labels:
- "dependencies"
- "automerge"
15 changes: 15 additions & 0 deletions .github/workflows/codesniffer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Codesniffer"

on:
pull_request:

push:
branches: ["*"]

schedule:
- cron: "0 8 * * 1"

jobs:
codesniffer:
name: "Codesniffer"
uses: contributte/.github/.github/workflows/codesniffer.yml@v1
17 changes: 17 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Coverage"

on:
pull_request:

push:
branches: ["*"]

schedule:
- cron: "0 8 * * 1"

jobs:
coverage:
name: "Phpunit"
uses: contributte/.github/.github/workflows/phpunit-coverage.yml@v1
with:
make: "init coverage"
17 changes: 17 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Phpstan"

on:
pull_request:

push:
branches: ["*"]

schedule:
- cron: "0 8 * * 1"

jobs:
phpstan:
name: "Phpstan"
uses: contributte/.github/.github/workflows/phpstan.yml@v1
with:
make: "init phpstan"
25 changes: 25 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Phpunit"

on:
pull_request:

push:
branches: [ "*" ]

schedule:
- cron: "0 8 * * 1"

jobs:
test82:
name: "Phpunit"
uses: contributte/.github/.github/workflows/phpunit.yml@v1
with:
php: "8.2"
make: "init tests"

test81:
name: "Phpunit"
uses: contributte/.github/.github/workflows/phpunit.yml@v1
with:
php: "8.1"
make: "init tests"
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.idea

# Nette
/config/local.neon

# Composer
/vendor

# NodeJS
/node_modules

# Assets
/www/dist

# Tests
/tests/*.log
/tests/tmp
/tests/coverage.html
7 changes: 7 additions & 0 deletions .phpstorm.meta.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace PHPSTORM_META {
override(\App\Model\Database\EntityManagerDecorator::getRepository(0), map([
'\App\Domain\User\User' => \App\Domain\User\UserRepository::class,
]));
}
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2024 Zerops s.r.o.

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:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
88 changes: 88 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
############################################################
# PROJECT ##################################################
############################################################
.PHONY: project
project: install setup

.PHONY: init
init:
cp config/local.neon.example config/local.neon

.PHONY: install
install:
composer install

.PHONY: setup
setup:
mkdir -p var/tmp var/log
chmod +0777 var/tmp var/log

.PHONY: clean
clean:
find var/tmp -mindepth 1 ! -name '.gitignore' -type f,d -exec rm -rf {} +
find var/log -mindepth 1 ! -name '.gitignore' -type f,d -exec rm -rf {} +

############################################################
# DEVELOPMENT ##############################################
############################################################
.PHONY: qa
qa: cs phpstan

.PHONY: cs
cs:
vendor/bin/codesniffer app tests

.PHONY: csf
csf:
vendor/bin/codefixer app tests

.PHONY: phpstan
phpstan:
vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=512M

.PHONY: tests
tests:
vendor/bin/tester -s -p php --colors 1 -C tests

.PHONY: coverage
coverage:
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./app tests

.PHONY: dev
dev:
NETTE_DEBUG=1 NETTE_ENV=dev php -S 0.0.0.0:8000 -t www

.PHONY: build
build:
NETTE_DEBUG=1 bin/console orm:schema-tool:drop --force --full-database
NETTE_DEBUG=1 bin/console migrations:migrate --no-interaction
NETTE_DEBUG=1 bin/console doctrine:fixtures:load --no-interaction --append

############################################################
# DEPLOYMENT ###############################################
############################################################
.PHONY: deploy
deploy:
$(MAKE) clean
$(MAKE) project
$(MAKE) build
$(MAKE) clean

############################################################
# DOCKER ###################################################
############################################################
.PHONY: docker-postgres
docker-postgres:
docker run \
-it \
-p 5432:5432 \
-e POSTGRES_PASSWORD=contributte \
-e POSTGRES_USER=contributte \
dockette/postgres:12

.PHONY: docker-adminer
docker-adminer:
docker run \
-it \
-p 9999:80 \
dockette/adminer:dg
Loading

0 comments on commit cd3a33c

Please sign in to comment.