Skip to content

Commit c1e39af

Browse files
authored
[Feature] [MST] Update to Symfony 6, improve project structure (#13)
1 parent b136ec7 commit c1e39af

File tree

128 files changed

+19024
-4843
lines changed

Some content is hidden

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

128 files changed

+19024
-4843
lines changed

.env

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
###> symfony/framework-bundle ###
1717
APP_ENV=dev
1818
APP_SECRET=CHANGEME
19+
HOST=localhost
20+
SCHEME=http
1921
###< symfony/framework-bundle ###
2022

2123
###> symfony/mailer ###
@@ -30,6 +32,3 @@ APP_SECRET=CHANGEME
3032
# DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
3133
DATABASE_URL="mysql://modular-symfony-template:modular-symfony-template@mysql:3306/modular-symfony-template?serverVersion=5.7"
3234
###< doctrine/doctrine-bundle ###
33-
34-
###> Team ###
35-
TEAM_LIMIT=10

.github/workflows/ci.yml

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,46 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: CI
42

5-
# Controls when the workflow will run
63
on:
7-
# Triggers the workflow on push or pull request events
84
push:
95
branches: [ '**' ]
106
pull_request:
117
branches: [ '**' ]
128

13-
# Allows you to run this workflow manually from the Actions tab
149
workflow_dispatch:
1510

16-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1711
jobs:
18-
# This workflow contains a single job called "build"
19-
build:
20-
# The type of runner that the job will run on
12+
ci:
2113
runs-on: ubuntu-latest
22-
23-
# Steps represent a sequence of tasks that will be executed as part of the job
2414
steps:
25-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
15+
2616
- uses: actions/checkout@v2
2717

28-
- name: Composer
29-
uses: php-actions/composer@v5
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.0'
22+
tools: composer, phpstan, phpcs
23+
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
3024

31-
quality:
32-
needs: build
33-
runs-on: ubuntu-latest
34-
steps:
25+
- name: Get composer cache directory
26+
id: composer-cache
27+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
3528

36-
- uses: actions/checkout@v2
29+
- name: Cache composer dependencies
30+
uses: actions/cache@v2
31+
with:
32+
path: ${{ steps.composer-cache.outputs.dir }}
33+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
34+
restore-keys: ${{ runner.os }}-composer-
3735

38-
- name: Composer
39-
uses: php-actions/composer@v5
36+
- name: Install Composer dependencies
37+
run: composer install --no-progress --prefer-dist --optimize-autoloader
38+
39+
- name: PHPCS
40+
run: phpcs src/
4041

4142
- name: PHPStan
42-
uses: php-actions/phpstan@v3
43-
with:
44-
path: src/
45-
level: 5
43+
run: phpstan analyse --level 5 --no-progress src/
4644

4745
- name: Codesniffer
4846
uses: pipeline-components/php-codesniffer@v0.12.3

.gitignore

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,15 @@
3131
###> deptrac-shim ###
3232
/tools/deptrac-shim/vendor/
3333
.deptrac.cache
34-
###< deptrac-shim ###
34+
###< deptrac-shim ###
35+
36+
###> sitemap ###
37+
/public/sitemap.*
38+
###< sitemap ###
39+
40+
###> symfony/webpack-encore-bundle ###
41+
/node_modules/
42+
/public/build/
43+
npm-debug.log
44+
yarn-error.log
45+
###< symfony/webpack-encore-bundle ###

README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
<img src="images/logo.png" alt="Logo" width="80" height="80">
1616
</a>-->
1717

18-
<h3 align="center">Modular Symfony Application Template</h3>
18+
<h3 align="center">Modular Symfony Template</h3>
1919

2020
<p align="center">
21-
This template helps you to get started with the modular programming aproach within the Symfony framework
2221
<br />
2322
<a href="https://github.com/Tim-Koertgen/modular-symfony-template"><strong>Explore the docs »</strong></a>
2423
<br />
@@ -62,8 +61,6 @@
6261
<!-- ABOUT THE PROJECT -->
6362
## About The Project
6463

65-
After struggling to find a modular symfony template I decided to create my own. I decided to split the application into 5 main parts: Backend, Client, Core, Frontend and Shared. Each layer has its own tasks.
66-
6764
### Backend
6865

6966
All your business logic should be located here. The backend layer is split into four layers
@@ -108,6 +105,7 @@ Shared contains classes that are used across the hole application like TransferO
108105
* [Twig](https://twig.symfony.com/)
109106
* [PHPDocker.io](https://phpdocker.io/)
110107
* [EasyAdminBundle](https://symfony.com/bundles/EasyAdminBundle/current/index.html)
108+
* [WebpackEncoreBundle](https://symfony.com/doc/current/frontend.html)
111109

112110
<p align="right">(<a href="#top">back to top</a>)</p>
113111

@@ -143,11 +141,9 @@ All you need to do is install [Docker](https://docs.docker.com/get-docker/) and
143141
## Usage
144142

145143
You should be able to access the following two endpoints after your installation is finished:
146-
- http://localhost:18000/team
144+
- http://localhost:18000/
147145
- http://localhost:18000/admin
148146

149-
Adding a team in the backend UI will make it appear in the frontend. This is just a really simple example of how to build your modules to make them work together.
150-
151147
<!--_For more examples, please refer to the [Documentation](https://example.com)_-->
152148
_Documentation is in progress_
153149

@@ -158,7 +154,7 @@ _Documentation is in progress_
158154
<!-- ROADMAP -->
159155
## Roadmap
160156

161-
- [] Generate TransferObjects from XML schema files
157+
- Nothing specific planned. I keep the template up to date with the experience I gain from developing apps using this template
162158

163159
See the [open issues](https://github.com/Tim-Koertgen/modular-symfony-template/issues) for a full list of proposed features (and known issues).
164160

@@ -229,7 +225,7 @@ Project Link: [https://github.com/Tim-Koertgen/modular-symfony-template](https:/
229225
[license-url]: https://github.com/Tim-Koertgen/modular-symfony-template/blob/main/LICENSE.txt
230226
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
231227
[linkedin-url]: https://linkedin.com/in/tim-körtgen
232-
[symfony-shield]: https://img.shields.io/badge/Symfony-5.3-red.svg?style=for-the-badge
233-
[symfony-url]: https://linkedin.com/in/tim-körtgen
228+
[symfony-shield]: https://img.shields.io/badge/Symfony-6.0-red.svg?style=for-the-badge
229+
[symfony-url]: https://symfony.com/
234230
[php-shield]: https://img.shields.io/badge/PHP-8.0-blue.svg?style=for-the-badge
235-
[php-url]: https://linkedin.com/in/tim-körtgen
231+
[php-url]: https://www.php.net/

assets/app.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Welcome to your app's main JavaScript file!
3+
*
4+
* We recommend including the built version of this JavaScript file
5+
* (and its CSS file) in your base layout (base.html.twig).
6+
*/
7+
8+
// any CSS you import will output into a single css file (app.css in this case)
9+
import './styles/app.css';
10+
11+
// start the Stimulus application
12+
import './bootstrap';

assets/bootstrap.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { startStimulusApp } from '@symfony/stimulus-bridge';
2+
3+
// Registers Stimulus controllers from controllers.json and in the controllers/ directory
4+
export const app = startStimulusApp(require.context(
5+
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
6+
true,
7+
/\.[jt]sx?$/
8+
));
9+
10+
// register any custom, 3rd party controllers here
11+
// app.register('some_controller_name', SomeImportedController);

assets/controllers.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"controllers": {
3+
"@symfony/ux-chartjs": {
4+
"chart": {
5+
"enabled": true,
6+
"fetch": "eager"
7+
}
8+
}
9+
},
10+
"entrypoints": []
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Controller } from '@hotwired/stimulus';
2+
3+
/*
4+
* This is an example Stimulus controller!
5+
*
6+
* Any element with a data-controller="hello" attribute will cause
7+
* this controller to be executed. The name "hello" comes from the filename:
8+
* hello_controller.js -> "hello"
9+
*
10+
* Delete this file or adapt it for your use!
11+
*/
12+
export default class extends Controller {
13+
connect() {
14+
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
15+
}
16+
}

bin/console

100755100644
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
use App\Kernel;
55
use Symfony\Bundle\FrameworkBundle\Console\Application;
66

7-
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
7+
if (!is_file(dirname(__DIR__) . '/vendor/autoload_runtime.php')) {
88
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
99
}
1010

11-
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
11+
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';
1212

1313
return function (array $context) {
14-
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
14+
$kernel = new Kernel($context['APP_ENV'], (bool)$context['APP_DEBUG']);
1515

1616
return new Application($kernel);
1717
};

0 commit comments

Comments
 (0)