A foundation for developing an application based on the Symfony framework. By cloning the repository and following the provided instructions, you can run this application independently. | Read-only mirror of https://github.com/republique-et-canton-de-geneve/php-symfony-base — République et canton de Genève. Issues & pull requests at the source.
  • HTML 97.7%
  • PHP 1.8%
  • Twig 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-12-28 08:36:01 +00:00
.github fix: correct github action 2025-12-01 15:51:01 +01:00
.vscode fix: phpstan warning 2025-12-11 16:01:09 +01:00
assets First version 2025-08-28 11:57:31 +02:00
bin First version 2025-08-28 11:57:31 +02:00
certificates Update PostgreSQL certificates and keys 2025-11-29 23:52:40 +01:00
cmd fix: phpstan warning 2025-12-11 16:01:09 +01:00
config feat: update configuration and documentation for response headers bundle 2025-12-19 17:52:35 +01:00
coverage chore: GithubAction update code coverage results 2025-12-28 08:36:01 +00:00
data Feat: add postgres SSL 2025-12-01 15:15:36 +01:00
docker chore: php-fixer 2025-12-10 18:36:25 +01:00
features Chore: behat test 2025-11-21 20:40:41 +01:00
migrations First version 2025-08-28 11:57:31 +02:00
public feat: update database configuration for PostgreSQL with SSL support and add CLI environment variable processor 2025-11-30 23:16:26 +01:00
src Fix: correct for php-cs and phpstan 2025-12-28 09:25:29 +01:00
templates First version 2025-08-28 11:57:31 +02:00
tests First version 2025-08-28 11:57:31 +02:00
translations First version 2025-08-28 11:57:31 +02:00
.env Chore: standardize docker files 2025-12-10 13:56:20 +01:00
.env.test Feat: add postgres SSL 2025-12-01 15:15:36 +01:00
.gitignore Feat: use bundle republique-et-canton-de-geneve/response-headers-bundle for response header injection 2025-12-28 09:20:13 +01:00
.nojekyll Create .nojekyll 2025-09-22 14:42:04 +02:00
.php-cs-fixer.dist.php fix: correct rector issues 2025-11-07 15:46:48 +01:00
behat.yml refactor: remove coverage PR comment step and update behat.yml to disable color output 2025-09-22 11:45:07 +02:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2025-08-28 13:39:05 +02:00
compose.override.example.yml Feat: use bundle republique-et-canton-de-geneve/response-headers-bundle for response header injection 2025-12-28 09:20:13 +01:00
composer.json Feat: use bundle republique-et-canton-de-geneve/response-headers-bundle for response header injection 2025-12-28 09:20:13 +01:00
composer.lock Feat: use bundle republique-et-canton-de-geneve/response-headers-bundle for response header injection 2025-12-28 09:20:13 +01:00
CONTRIBUTING Create CONTRIBUTING 2025-08-28 13:52:07 +02:00
docker-compose.yml Chore: standardize docker files 2025-12-10 13:56:20 +01:00
eslint.config.mjs First version 2025-08-28 11:57:31 +02:00
LICENSE Create LICENSE 2025-08-28 13:45:04 +02:00
LICENSE.txt First version 2025-08-28 11:57:31 +02:00
package.json chore: 2025-10-17 16:31:30 +02:00
phpcs.xml.dist First version 2025-08-28 11:57:31 +02:00
phpstan.neon Fix: correct for php-cs and phpstan 2025-12-28 09:25:29 +01:00
phpunit.xml First version 2025-08-28 11:57:31 +02:00
README.md Feat: use bundle republique-et-canton-de-geneve/response-headers-bundle for response header injection 2025-12-28 09:20:13 +01:00
rector.php First version 2025-08-28 11:57:31 +02:00
release.properties First version 2025-08-28 11:57:31 +02:00
SECURITY.md Create SECURITY.md 2025-09-23 11:07:49 +02:00
sonar-project.properties feat: implement constructor for BaseFrontController to initialize menu and logger 2025-10-02 18:10:59 +02:00
symfony.lock Feat: use bundle republique-et-canton-de-geneve/response-headers-bundle for response header injection 2025-12-28 09:20:13 +01:00
webpack.config.js First version 2025-08-28 11:57:31 +02:00
yarn.lock Chore: update lib 2025-11-21 20:21:36 +01:00

SONAR Qube

Quality gate Quality Gate Status Bugs Code Smells Duplicated Lines (%)

Code coverage

coverage line coverage branche

Detailled code coverage detail report

Test

php-cs-fixer twig-cs-fixer phpstan rector symfony behat and code coverage

Application Template Symfony Framework 7.x

License

License: AGPL v3

Purpose

This archive is designed to serve as a foundation for developing an application based on the Symfony framework. By cloning the repository and following the provided instructions, you can run this application independently.

Symfony

https://symfony.com/

Features

The application includes the following components and functionalities:

  • Database Management

    • Integration with Doctrine ORM.
  • Authentication

    • Support for SAML2 authentication.
    • Environment variablebased authentication for development environments.
  • Security

    • Role-based access control using Symfonys Security Voter system.
  • Assets Management

    • Webpack integration for building and managing assets (CSS, JavaScript).
  • User Interface

    • Templates rendered with Twig.
    • Styling with Bootstrap.
  • Logging

    • Application-level logging.
  • Configuration

    • Parameter management for flexible configuration.
  • Administration Tools

    • Log visualization.
    • Application parameter management.
    • Environment and server health checks.
  • Messaging

    • Flash messages for user feedback.
    • Temporary information or maintenance messages.
  • Navigation

    • A simple and efficient menu system.
  • Error Handling

    • Predefined error pages: 403, 404, 500, and 503.
  • Rich Text Editing

    • Integration of CKEditor.
  • Test

    • Behat

Requirement et installation

Requirement

  • Web Server :
    • appache server php > 8.3
  • Command line
    • php > 8.3
    • git
    • composer
    • nodejs
    • yarn

Installation

From the console

git clone
cd your_project

composer install
yarn install

yarn encore prod
cd public
ln -s . build/build
cd ..

configuration

Configure your .env file Authentification is made by SAML2, the application needs a Identity provider(IDP).

Version

The file release.properties contains the application revision number

Login with docker SAML2

user: admin password: 123

Test without SAML2

  • Create a new env.local file and write the content :

    # Use to know the type of server 'prod', 'rec', 'dev' or 'local'
    APP_SERVER_TYPE=local
    APP_URL=http://localhost/symfony-demo/htdocs/public
    
    APP_AUTH_FROM_ENV_VAR=true
    APP_USER_LOGIN="bond007"
    APP_USER_ROLES=UTILISATEUR|ADMIN
    APP_USER_EMAIL=James.Bond@mydomain.com
    APP_USER_FIRSTNAME=James
    APP_USER_NAME=James
    APP_USER_FULLNAME="James Bond (MI6)"
    

Use and configure an other database

  • Edit file .env the APP_DATABASE_URL define the database.
  • Run the command : cmd/console doctrine:database:create cmd/console doctrine:schema:create

commands line

Some usefull shell command

For example :

cmd/update_composer

  • Code Analyse
    • cmd/check -> check the code with many tools
    • cmd/php-cs -> code analyse php code sniffer
    • cmd/php-cs-fix -> code fix php code sniffer
    • cmd/twig-cs -> code analyse php code sniffer
    • cmd/twig-cs-fix -> code fix php code sniffer
    • cmd/eslint -> javascript code analyse ESLINT
    • cmd/eslint-fixer -> code fixe javascript analyse ESLINT
    • cmd/phpstan -> code analyse PHPStan
    • cmd/symfony-check -> check yaml config file, twig file and constructor injection parameters
    • cmd/behat -> run behat test
    • cmd/behat-coverage -> run behat test with code coverage
    • cmd/make-doc -> make a doc information on symfony system
    • cmd/rector-check -> check the php code need a refactoring
    • cmd/rector-exec -> refactor the php code
  • Code maintenance
    • cmd/clear -> clear the cache and temporary files
  • Update lib
    • cmd/update-composer -> update php librairies
    • cmd/make-autoload -> optimise the composer class loading ( to do when you move or suppress class file)
    • cmd/update-asset -> update nodejs librairies
    • cmd/update-all -> update all, composer and node js
  • Asset
    • cmd/make-prod -> create a webpack package for production
    • cmd/make-asset -> create a webpack package for dev
    • cmd/watch-asset -> create a webpack package for dev in watch mode
    • cmd/make-symlink -> recreate symbolic link for the public asset

Docker

Spcific for this project

  • php : xdebug, apache, web, cli, composer, symfony, nodejs, yarn
  • database : mysql and ( mariadb, postgres) and adminer
  • mailhog
  • saml2

Build images and container

from root folder :

 docker-compose build --pull
 docker-compose up --build -d