Skip to content

Commit 69c7e58

Browse files
committedJun 10, 2021
AR-519: Basic symfony with API platform
1 parent ba8164a commit 69c7e58

36 files changed

+7699
-51
lines changed
 

‎.docker/vhost.conf

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# @see https://symfony.com/doc/current/setup/web_server_configuration.html
2+
server {
3+
listen 80;
4+
server_name localhost;
5+
root /app/public;
6+
7+
location / {
8+
# try to serve file directly, fallback to index.php
9+
try_files $uri /index.php$is_args$args;
10+
}
11+
12+
location ~ ^/index\.php(/|$) {
13+
fastcgi_pass phpfpm:9000;
14+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
15+
include fastcgi_params;
16+
17+
# optionally set the value of the environment variables used in the application
18+
# fastcgi_param APP_ENV prod;
19+
# fastcgi_param APP_SECRET <app-secret-id>;
20+
# fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";
21+
22+
# When you are using symlinks to link the document root to the
23+
# current version of your application, you should pass the real
24+
# application path instead of the path to the symlink to PHP
25+
# FPM.
26+
# Otherwise, PHP's OPcache may not properly detect changes to
27+
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
28+
# for more information).
29+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
30+
fastcgi_param DOCUMENT_ROOT $realpath_root;
31+
# Prevents URIs that include the front controller. This will 404:
32+
# http://domain.tld/index.php/some-path
33+
# Remove the internal directive to allow URIs like this
34+
internal;
35+
}
36+
37+
# return 404 for all other php files not matching the front controller
38+
# this prevents access to other php files you don't want to be accessible.
39+
location ~ \.php$ {
40+
return 404;
41+
}
42+
43+
error_log /var/log/nginx/project_error.log;
44+
access_log /var/log/nginx/project_access.log;
45+
}

‎.env

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
COMPOSE_PROJECT_NAME=displayapiservice
2+
COMPOSE_DOMAIN=displayapiservice.local.itkdev.dk
3+
4+
# In all environments, the following files are loaded if they exist,
5+
# the latter taking precedence over the former:
6+
#
7+
# * .env contains default values for the environment variables needed by the app
8+
# * .env.local uncommitted file with local overrides
9+
# * .env.$APP_ENV committed environment-specific defaults
10+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
11+
#
12+
# Real environment variables win over .env files.
13+
#
14+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
15+
#
16+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
17+
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
18+
19+
###> symfony/framework-bundle ###
20+
APP_ENV=dev
21+
APP_SECRET=22d8a60c047b96413b3337e3ddae3da9
22+
###< symfony/framework-bundle ###
23+
24+
###> doctrine/doctrine-bundle ###
25+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
26+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
27+
#
28+
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
29+
# DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
30+
DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
31+
###< doctrine/doctrine-bundle ###
32+
33+
###> nelmio/cors-bundle ###
34+
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
35+
###< nelmio/cors-bundle ###

‎.gitignore

Lines changed: 8 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,9 @@
1-
# Cache and logs (Symfony2)
2-
/app/cache/*
3-
/app/logs/*
4-
!app/cache/.gitkeep
5-
!app/logs/.gitkeep
6-
7-
# Email spool folder
8-
/app/spool/*
9-
10-
# Cache, session files and logs (Symfony3)
11-
/var/cache/*
12-
/var/logs/*
13-
/var/sessions/*
14-
!var/cache/.gitkeep
15-
!var/logs/.gitkeep
16-
!var/sessions/.gitkeep
17-
18-
# Logs (Symfony4)
19-
/var/log/*
20-
!var/log/.gitkeep
21-
22-
# Parameters
23-
/app/config/parameters.yml
24-
/app/config/parameters.ini
25-
26-
# Managed by Composer
27-
/app/bootstrap.php.cache
28-
/var/bootstrap.php.cache
29-
/bin/*
30-
!bin/console
31-
!bin/symfony_requirements
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/
328
/vendor/
33-
34-
# Assets and user uploads
35-
/web/bundles/
36-
/web/uploads/
37-
38-
# PHPUnit
39-
/app/phpunit.xml
40-
/phpunit.xml
41-
42-
# Build data
43-
/build/
44-
45-
# Composer PHAR
46-
/composer.phar
47-
48-
# Backup entities generated with doctrine:generate:entities command
49-
**/Entity/*~
50-
51-
# Embedded web-server pid file
52-
/.web-server-pid
9+
###< symfony/framework-bundle ###

‎bin/console

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

‎composer.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"type": "project",
3+
"license": "proprietary",
4+
"minimum-stability": "stable",
5+
"prefer-stable": true,
6+
"require": {
7+
"php": ">=7.2.5",
8+
"ext-ctype": "*",
9+
"ext-iconv": "*",
10+
"api-platform/core": "^2.6",
11+
"composer/package-versions-deprecated": "1.11.99.2",
12+
"doctrine/annotations": "^1.0",
13+
"doctrine/doctrine-bundle": "^2.4",
14+
"doctrine/doctrine-migrations-bundle": "^3.1",
15+
"doctrine/orm": "^2.9",
16+
"nelmio/cors-bundle": "^2.1",
17+
"phpdocumentor/reflection-docblock": "^5.2",
18+
"symfony/asset": "5.3.*",
19+
"symfony/console": "5.3.*",
20+
"symfony/dotenv": "5.3.*",
21+
"symfony/expression-language": "5.3.*",
22+
"symfony/flex": "^1.3.1",
23+
"symfony/framework-bundle": "5.3.*",
24+
"symfony/property-access": "5.3.*",
25+
"symfony/property-info": "5.3.*",
26+
"symfony/proxy-manager-bridge": "5.3.*",
27+
"symfony/runtime": "5.3.*",
28+
"symfony/security-bundle": "5.3.*",
29+
"symfony/serializer": "5.3.*",
30+
"symfony/twig-bundle": "5.3.*",
31+
"symfony/validator": "5.3.*",
32+
"symfony/yaml": "5.3.*"
33+
},
34+
"config": {
35+
"optimize-autoloader": true,
36+
"preferred-install": {
37+
"*": "dist"
38+
},
39+
"sort-packages": true
40+
},
41+
"autoload": {
42+
"psr-4": {
43+
"App\\": "src/"
44+
}
45+
},
46+
"autoload-dev": {
47+
"psr-4": {
48+
"App\\Tests\\": "tests/"
49+
}
50+
},
51+
"replace": {
52+
"symfony/polyfill-ctype": "*",
53+
"symfony/polyfill-iconv": "*",
54+
"symfony/polyfill-php72": "*"
55+
},
56+
"scripts": {
57+
"auto-scripts": {
58+
"cache:clear": "symfony-cmd",
59+
"assets:install %PUBLIC_DIR%": "symfony-cmd"
60+
},
61+
"post-install-cmd": [
62+
"@auto-scripts"
63+
],
64+
"post-update-cmd": [
65+
"@auto-scripts"
66+
]
67+
},
68+
"conflict": {
69+
"symfony/symfony": "*"
70+
},
71+
"extra": {
72+
"symfony": {
73+
"allow-contrib": false,
74+
"require": "5.3.*"
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)
Please sign in to comment.