Skip to content

Commit 93b3516

Browse files
committed
Initial commit
0 parents  commit 93b3516

File tree

107 files changed

+14888
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+14888
-0
lines changed

.editorconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
; top-most EditorConfig file
2+
root = true
3+
4+
; Unix-style newlines
5+
[*]
6+
charset = utf-8
7+
end_of_line = LF
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{php,html,twig}]
12+
indent_style = space
13+
indent_size = 4
14+
15+
[*.md]
16+
max_line_length = 80
17+
18+
[COMMIT_EDITMSG]
19+
max_line_length = 0
20+
21+
[*.{neon,neon.dist,yaml}]
22+
indent_style = space
23+
indent_size = 4

.env

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$APP_ENV committed environment-specific defaults
7+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
# https://symfony.com/doc/current/configuration/secrets.html
13+
#
14+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
15+
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
16+
17+
###> symfony/framework-bundle ###
18+
APP_ENV=dev
19+
APP_SECRET=
20+
###< symfony/framework-bundle ###
21+
22+
###> doctrine/doctrine-bundle ###
23+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
24+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
25+
#
26+
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
27+
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
28+
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
29+
# DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8"
30+
DATABASE_URL="mysql://acme:acme@database:3306/acme?serverVersion=8.0.32&charset=utf8mb4"
31+
###< doctrine/doctrine-bundle ###
32+
33+
###> symfony/mailer ###
34+
# MAILER_DSN=null://null
35+
MAILER_DSN=smtp://mailer:1025
36+
###< symfony/mailer ###
37+
38+
###> symfony/messenger ###
39+
# Choose one of the transports below
40+
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
41+
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
42+
# MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
43+
MESSENGER_TRANSPORT_DSN=redis://redis:6379/messages
44+
###< symfony/messenger ###

.env.dev

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
###> symfony/framework-bundle ###
2+
APP_SECRET=ca49d31b6dd9589bae6bd486bcc8eaca
3+
###< symfony/framework-bundle ###

.env.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='$ecretf0rt3st'
4+
SYMFONY_DEPRECATIONS_HELPER=999999
5+
PANTHER_APP_ENV=panther
6+
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
###> symfony/framework-bundle ###
2+
/.env.local
3+
/.env.local.php
4+
/.env.*.local
5+
/config/secrets/prod/prod.decrypt.private.php
6+
/public/bundles/
7+
/var/
8+
/vendor/
9+
###< symfony/framework-bundle ###
10+
11+
###> friendsofphp/php-cs-fixer ###
12+
/.php-cs-fixer.php
13+
/.php-cs-fixer.cache
14+
###< friendsofphp/php-cs-fixer ###
15+
16+
###> phpstan/phpstan ###
17+
phpstan.neon
18+
###< phpstan/phpstan ###
19+
20+
###> symfony/asset-mapper ###
21+
/public/assets/
22+
/assets/vendor/
23+
###< symfony/asset-mapper ###
24+
25+
###> phpunit/phpunit ###
26+
/phpunit.xml
27+
/.phpunit.result.cache
28+
###< phpunit/phpunit ###
29+
30+
###> vincentlanglet/twig-cs-fixer ###
31+
/.twig-cs-fixer.cache
32+
###< vincentlanglet/twig-cs-fixer ###
33+
34+
/coverage
35+
/docker/ssl

.php-cs-fixer.dist.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
use PhpCsFixer\Config;
5+
use PhpCsFixer\Finder;
6+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
7+
8+
$finder = (new Finder())
9+
->in(__DIR__)
10+
->exclude('var');
11+
12+
return (new Config())
13+
->setFinder($finder)
14+
->setParallelConfig(ParallelConfigFactory::detect())
15+
->setRules([
16+
'@Symfony' => true,
17+
'@Symfony:risky' => true,
18+
'@PER-CS2.0' => true,
19+
'ordered_interfaces' => true,
20+
]);

.twig-cs-fixer.dist.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
use TwigCsFixer\Config\Config;
5+
6+
$config = new Config();
7+
$config->allowNonFixableRules();
8+
9+
return $config;

Makefile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.DEFAULT_GOAL := help
2+
.PHONY: console composer install qa restart start start_containers stop
3+
4+
# Show this help
5+
help:
6+
@cat $(MAKEFILE_LIST) | docker run --rm -i xanders/make-help
7+
8+
##
9+
## Docker
10+
##
11+
12+
# Build the containers
13+
install:
14+
@mkcert "acme.localhost"
15+
@mv "acme.localhost.pem" docker/ssl/certificate.pem
16+
@mv "acme.localhost-key.pem" docker/ssl/certificate-key.pem
17+
@docker compose build
18+
19+
set_permissions:
20+
@docker compose exec php chown -R www-data:www-data /srv/var
21+
22+
# Start the containers
23+
start: start_containers set_permissions
24+
25+
start_containers: compose.yaml
26+
@docker compose up -d --remove-orphans
27+
28+
# Stop the containers
29+
stop:
30+
@docker compose stop
31+
32+
# Restart the containers
33+
restart: stop start
34+
35+
vendor: composer.lock
36+
@docker compose exec php composer install
37+
38+
##
39+
## Tools
40+
##
41+
42+
# Run a console command
43+
# Example: `make composer run="outdated -D"`
44+
composer:
45+
@docker compose exec php composer $(run)
46+
47+
# Run a console command
48+
# Example: `make console run="cache:clear"`
49+
console:
50+
@docker compose exec php bin/console $(run)
51+
52+
# Run a PHP script
53+
# Example: `make php run="vendor/bin/phpunit"`
54+
php:
55+
@docker compose exec php php $(run)
56+
57+
# Run all QA tools
58+
qa:
59+
@docker compose exec php composer qa

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Opinionated template to bootstrap a Symfony application
2+
3+
## Requirements
4+
5+
* Linux, MacOS or WSL2
6+
* `make`
7+
* `mkcert`
8+
* Docker Desktop
9+
10+
## Installation
11+
12+
* Clone the repository
13+
* Run `make install`
14+
15+
## Start the project
16+
17+
* Run `make start`
18+
* Open [https://acme.localhost](https://acme.localhost) in your browser
19+
* Run `make` for more commands
20+
21+
## Customization
22+
23+
* Configure the Docker services prefix:
24+
* `compose.yaml` (default: `acme`)
25+
* Configure the database name, username and password:
26+
* `compose.yaml` (default: `acme`)
27+
* `docker/mysql/docker-entrypoint-initdb.d/create_database_test.sql` (default: `acme`)
28+
* Configure the domain name:
29+
* `Makefile` (default: `acme.localhost`)
30+
31+
## Docker services
32+
33+
* HTTP server: [Caddy](https://caddyserver.com/) (port: 443)
34+
* [PHP-FPM](https://www.php.net/) (version: 8.3) with [Symfony](https://symfony.com/) (version: 7.2)
35+
* Database: [MySQL](https://www.mysql.com/) (8.0.32)
36+
* Messages queue: [Redis](https://redis.io/)
37+
* Messages worker

ROADMAP.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
* GitHub Actions
2+
* GitLab CI
3+
* Bitbucket Pipelines
4+
* AWS
5+
* Config YAML => PHP
6+
* Vault
7+
* Update PHPStan to 2.0
8+
* TOTP authentication

assets/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './styles/app.css';

assets/styles/app.css

Whitespace-only changes.

bin/console

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
use App\Kernel;
5+
use Symfony\Bundle\FrameworkBundle\Console\Application;
6+
7+
if (!is_dir(dirname(__DIR__).'/vendor')) {
8+
throw new LogicException('Dependencies are missing. Try running "composer install".');
9+
}
10+
11+
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
12+
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
13+
}
14+
15+
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
16+
17+
return function (array $context) {
18+
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
19+
20+
return new Application($kernel);
21+
};

bin/phpunit

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
if (!ini_get('date.timezone')) {
5+
ini_set('date.timezone', 'UTC');
6+
}
7+
8+
if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
9+
if (PHP_VERSION_ID >= 80000) {
10+
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
11+
} else {
12+
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
13+
require PHPUNIT_COMPOSER_INSTALL;
14+
PHPUnit\TextUI\Command::main();
15+
}
16+
} else {
17+
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
18+
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
19+
exit(1);
20+
}
21+
22+
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
23+
}

compose.override.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
services:
3+
###> symfony/mailer ###
4+
mailer:
5+
image: axllent/mailpit
6+
ports:
7+
- "1025"
8+
- "8025:8025"
9+
environment:
10+
MP_SMTP_AUTH_ACCEPT_ANY: 1
11+
MP_SMTP_AUTH_ALLOW_INSECURE: 1
12+
###< symfony/mailer ###

compose.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: acme
2+
3+
services:
4+
5+
http:
6+
image: caddy:latest
7+
ports:
8+
- "80:80"
9+
- "443:443"
10+
volumes:
11+
- ./docker/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
12+
- ./docker/ssl:/etc/ssl:ro
13+
- ./public:/srv:ro
14+
- caddy_config:/config
15+
- caddy_data:/data
16+
depends_on:
17+
- php
18+
19+
php:
20+
build: docker/php
21+
volumes:
22+
- ./:/srv
23+
depends_on:
24+
- database
25+
26+
database:
27+
image: mysql:8.0.32
28+
ports:
29+
- "3306:3306"
30+
volumes:
31+
- mysql_data:/var/lib/mysql
32+
- ./docker/mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
33+
environment:
34+
MYSQL_ROOT_PASSWORD: root
35+
MYSQL_DATABASE: acme
36+
MYSQL_USER: acme
37+
MYSQL_PASSWORD: acme
38+
39+
redis:
40+
image: redis
41+
42+
worker:
43+
build: docker/php
44+
volumes:
45+
- ./:/srv
46+
depends_on:
47+
- database
48+
- redis
49+
command: php /srv/bin/console messenger:consume -vv
50+
51+
volumes:
52+
53+
caddy_config:
54+
caddy_data:
55+
mysql_data:

0 commit comments

Comments
 (0)