Skip to content

Commit 733dbcc

Browse files
committed
chore: 🤖 composer require api-platform/api-pack
1 parent 72f24fe commit 733dbcc

19 files changed

+4712
-844
lines changed

.env

+14
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,17 @@
1818
APP_ENV=dev
1919
APP_SECRET=bd7c5ee610a60fbb7d9781ebcf820b79
2020
###< 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+
###< doctrine/doctrine-bundle ###
31+
32+
###> nelmio/cors-bundle ###
33+
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
34+
###< nelmio/cors-bundle ###

composer.json

+16-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,29 @@
77
"php": ">=8.2",
88
"ext-ctype": "*",
99
"ext-iconv": "*",
10+
"api-platform/core": "^3.3",
11+
"doctrine/dbal": "^3",
12+
"doctrine/doctrine-bundle": "^2.12",
13+
"doctrine/doctrine-migrations-bundle": "^3.3",
14+
"doctrine/orm": "^3.2",
15+
"nelmio/cors-bundle": "^2.5",
16+
"phpdocumentor/reflection-docblock": "^5.4",
17+
"phpstan/phpdoc-parser": "^1.29",
18+
"symfony/asset": "7.1.*",
1019
"symfony/console": "7.1.*",
1120
"symfony/dotenv": "7.1.*",
21+
"symfony/expression-language": "7.1.*",
1222
"symfony/flex": "^2",
1323
"symfony/framework-bundle": "7.1.*",
24+
"symfony/property-access": "7.1.*",
25+
"symfony/property-info": "7.1.*",
1426
"symfony/runtime": "7.1.*",
27+
"symfony/security-bundle": "7.1.*",
28+
"symfony/serializer": "7.1.*",
29+
"symfony/twig-bundle": "7.1.*",
30+
"symfony/validator": "7.1.*",
1531
"symfony/yaml": "7.1.*"
1632
},
17-
"require-dev": {
18-
},
1933
"config": {
2034
"allow-plugins": {
2135
"php-http/discovery": true,

composer.lock

+4,420-842
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/bundles.php

+6
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@
22

33
return [
44
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
5+
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
6+
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
7+
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
8+
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
9+
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
10+
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
511
];

config/packages/api_platform.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
api_platform:
2+
title: Hello API Platform
3+
version: 1.0.0
4+
formats:
5+
jsonld: ['application/ld+json']
6+
docs_formats:
7+
jsonld: ['application/ld+json']
8+
jsonopenapi: ['application/vnd.openapi+json']
9+
html: ['text/html']
10+
defaults:
11+
stateless: true
12+
cache_headers:
13+
vary: ['Content-Type', 'Authorization', 'Origin']
14+
extra_properties:
15+
standard_put: true
16+
rfc_7807_compliant_errors: true
17+
keep_legacy_inflector: false
18+
use_symfony_listeners: true

config/packages/doctrine.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
doctrine:
2+
dbal:
3+
url: '%env(resolve:DATABASE_URL)%'
4+
5+
# IMPORTANT: You MUST configure your server version,
6+
# either here or in the DATABASE_URL env var (see .env file)
7+
#server_version: '16'
8+
9+
profiling_collect_backtrace: '%kernel.debug%'
10+
use_savepoints: true
11+
orm:
12+
auto_generate_proxy_classes: true
13+
enable_lazy_ghost_objects: true
14+
report_fields_where_declared: true
15+
validate_xml_mapping: true
16+
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
17+
auto_mapping: true
18+
mappings:
19+
App:
20+
type: attribute
21+
is_bundle: false
22+
dir: '%kernel.project_dir%/src/Entity'
23+
prefix: 'App\Entity'
24+
alias: App
25+
controller_resolver:
26+
auto_mapping: false
27+
28+
when@test:
29+
doctrine:
30+
dbal:
31+
# "TEST_TOKEN" is typically set by ParaTest
32+
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
33+
34+
when@prod:
35+
doctrine:
36+
orm:
37+
auto_generate_proxy_classes: false
38+
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
39+
query_cache_driver:
40+
type: pool
41+
pool: doctrine.system_cache_pool
42+
result_cache_driver:
43+
type: pool
44+
pool: doctrine.result_cache_pool
45+
46+
framework:
47+
cache:
48+
pools:
49+
doctrine.result_cache_pool:
50+
adapter: cache.app
51+
doctrine.system_cache_pool:
52+
adapter: cache.system
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
doctrine_migrations:
2+
migrations_paths:
3+
# namespace is arbitrary but should be different from App\Migrations
4+
# as migrations classes should NOT be autoloaded
5+
'DoctrineMigrations': '%kernel.project_dir%/migrations'
6+
enable_profiler: false

config/packages/nelmio_cors.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
nelmio_cors:
2+
defaults:
3+
origin_regex: true
4+
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
5+
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
6+
allow_headers: ['Content-Type', 'Authorization']
7+
expose_headers: ['Link']
8+
max_age: 3600
9+
paths:
10+
'^/': null

config/packages/security.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
security:
2+
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
3+
password_hashers:
4+
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
5+
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
6+
providers:
7+
users_in_memory: { memory: null }
8+
firewalls:
9+
dev:
10+
pattern: ^/(_(profiler|wdt)|css|images|js)/
11+
security: false
12+
main:
13+
lazy: true
14+
provider: users_in_memory
15+
16+
# activate different ways to authenticate
17+
# https://symfony.com/doc/current/security.html#the-firewall
18+
19+
# https://symfony.com/doc/current/security/impersonating_user.html
20+
# switch_user: true
21+
22+
# Easy way to control access for large sections of your site
23+
# Note: Only the *first* access control that matches will be used
24+
access_control:
25+
# - { path: ^/admin, roles: ROLE_ADMIN }
26+
# - { path: ^/profile, roles: ROLE_USER }
27+
28+
when@test:
29+
security:
30+
password_hashers:
31+
# By default, password hashers are resource intensive and take time. This is
32+
# important to generate secure password hashes. In tests however, secure hashes
33+
# are not important, waste resources and increase test times. The following
34+
# reduces the work factor to the lowest possible values.
35+
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
36+
algorithm: auto
37+
cost: 4 # Lowest possible value for bcrypt
38+
time_cost: 3 # Lowest possible value for argon
39+
memory_cost: 10 # Lowest possible value for argon

config/packages/twig.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
twig:
2+
file_name_pattern: '*.twig'
3+
4+
when@test:
5+
twig:
6+
strict_variables: true

config/packages/validator.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
framework:
2+
validation:
3+
# Enables validator auto-mapping support.
4+
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
5+
#auto_mapping:
6+
# App\Entity\: []
7+
8+
when@test:
9+
framework:
10+
validation:
11+
not_compromised_password: false

config/routes/api_platform.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
api_platform:
2+
resource: .
3+
type: api_platform
4+
prefix: /api

config/routes/security.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_security_logout:
2+
resource: security.route_loader.logout
3+
type: service

migrations/.gitignore

Whitespace-only changes.

src/ApiResource/.gitignore

Whitespace-only changes.

src/Entity/.gitignore

Whitespace-only changes.

src/Repository/.gitignore

Whitespace-only changes.

symfony.lock

+91
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,57 @@
11
{
2+
"api-platform/core": {
3+
"version": "3.3",
4+
"recipe": {
5+
"repo": "github.com/symfony/recipes",
6+
"branch": "main",
7+
"version": "3.3",
8+
"ref": "74b45ac570c57eb1fbe56c984091a9ff87e18bab"
9+
},
10+
"files": [
11+
"config/packages/api_platform.yaml",
12+
"config/routes/api_platform.yaml",
13+
"src/ApiResource/.gitignore"
14+
]
15+
},
16+
"doctrine/doctrine-bundle": {
17+
"version": "2.12",
18+
"recipe": {
19+
"repo": "github.com/symfony/recipes",
20+
"branch": "main",
21+
"version": "2.12",
22+
"ref": "7266981c201efbbe02ae53c87f8bb378e3f825ae"
23+
},
24+
"files": [
25+
"config/packages/doctrine.yaml",
26+
"src/Entity/.gitignore",
27+
"src/Repository/.gitignore"
28+
]
29+
},
30+
"doctrine/doctrine-migrations-bundle": {
31+
"version": "3.3",
32+
"recipe": {
33+
"repo": "github.com/symfony/recipes",
34+
"branch": "main",
35+
"version": "3.1",
36+
"ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33"
37+
},
38+
"files": [
39+
"config/packages/doctrine_migrations.yaml",
40+
"migrations/.gitignore"
41+
]
42+
},
43+
"nelmio/cors-bundle": {
44+
"version": "2.5",
45+
"recipe": {
46+
"repo": "github.com/symfony/recipes",
47+
"branch": "main",
48+
"version": "1.5",
49+
"ref": "6bea22e6c564fba3a1391615cada1437d0bde39c"
50+
},
51+
"files": [
52+
"config/packages/nelmio_cors.yaml"
53+
]
54+
},
255
"symfony/console": {
356
"version": "7.1",
457
"recipe": {
@@ -54,5 +107,43 @@
54107
"config/packages/routing.yaml",
55108
"config/routes.yaml"
56109
]
110+
},
111+
"symfony/security-bundle": {
112+
"version": "7.1",
113+
"recipe": {
114+
"repo": "github.com/symfony/recipes",
115+
"branch": "main",
116+
"version": "6.4",
117+
"ref": "2ae08430db28c8eb4476605894296c82a642028f"
118+
},
119+
"files": [
120+
"config/packages/security.yaml",
121+
"config/routes/security.yaml"
122+
]
123+
},
124+
"symfony/twig-bundle": {
125+
"version": "7.1",
126+
"recipe": {
127+
"repo": "github.com/symfony/recipes",
128+
"branch": "main",
129+
"version": "6.4",
130+
"ref": "cab5fd2a13a45c266d45a7d9337e28dee6272877"
131+
},
132+
"files": [
133+
"config/packages/twig.yaml",
134+
"templates/base.html.twig"
135+
]
136+
},
137+
"symfony/validator": {
138+
"version": "7.1",
139+
"recipe": {
140+
"repo": "github.com/symfony/recipes",
141+
"branch": "main",
142+
"version": "7.0",
143+
"ref": "8c1c4e28d26a124b0bb273f537ca8ce443472bfd"
144+
},
145+
"files": [
146+
"config/packages/validator.yaml"
147+
]
57148
}
58149
}

templates/base.html.twig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>{% block title %}Welcome!{% endblock %}</title>
6+
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
7+
{% block stylesheets %}
8+
{% endblock %}
9+
10+
{% block javascripts %}
11+
{% endblock %}
12+
</head>
13+
<body>
14+
{% block body %}{% endblock %}
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)