-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
155 lines (137 loc) · 3.68 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
# Maak benodigde directories
mkdir -p var/cache var/log var/sessions \
config/packages \
public \
src/{Controller,Entity,Repository,Service} \
templates \
migrations \
assets/{styles,vue/{components,store}}
# Maak benodigde bestanden aan als ze nog niet bestaan
touch var/.gitkeep
touch config/packages/.gitkeep
touch public/.gitkeep
touch src/Controller/.gitkeep
touch src/Entity/.gitkeep
touch src/Repository/.gitkeep
touch src/Service/.gitkeep
touch templates/.gitkeep
touch migrations/.gitkeep
touch assets/styles/.gitkeep
touch assets/vue/components/.gitkeep
touch assets/vue/store/.gitkeep
# Maak een basis public/index.php
cat > public/index.php << 'EOF'
<?php
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
EOF
# Maak een basis src/Kernel.php
cat > src/Kernel.php << 'EOF'
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
}
EOF
# Maak een basis composer.json als die nog niet bestaat
cat > composer.json << 'EOF'
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.10",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.15",
"symfony/console": "6.3.*",
"symfony/dotenv": "6.3.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "6.3.*",
"symfony/runtime": "6.3.*",
"symfony/yaml": "6.3.*"
},
"require-dev": {
"symfony/maker-bundle": "^1.50"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "6.3.*"
}
}
}
EOF
# Maak een basis .env bestand
cat > .env << 'EOF'
APP_ENV=dev
APP_SECRET=5b93c6cf97c3b92f3c5314c80f3a0216
DATABASE_URL="mysql://user:password@database:3306/kortingen_db?serverVersion=8.0"
EOF
# Maak een basis config/bundles.php
cat > config/bundles.php << 'EOF'
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
];
EOF
# Install Symfony security bundle
composer require symfony/security-bundle
# Clear Symfony cache
php bin/console cache:clear
# Zet de juiste permissies
chmod -R 777 var
echo "Directory structure and base files created successfully!"