Skip to content

cyrilverloop/symfony-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

symfony-demo

This is a simple Symfony 7.0 demo project using PHP 8.3.

This demo is using AssetMapper. To see a version with Encore, switch to the unmaintained webpack-encore branch.

License Type coverage Minimum PHP version

Installation

Downloading the project :

user@host ~$ cd [PATH_WHERE_TO_PUT_THE_PROJECT] # E.g. ~/projects/
user@host projects$ git clone https://github.com/cyrilverloop/symfony-demo.git
user@host projects$ cd symfony-demo

This demo uses 3 Docker images based on :

  1. mariadb to run the database;
  2. php:apache to run the web server;
  3. composer to install PHP dependencies;

Building the image

Define a mariadb root password in the ./mariadb/.password file (see ./mariadb/.password.dist example) and build the app image :

user@host symfony-demo$ docker compose build

Installing PHP dependencies

Define the database configuration for Symfony (see ./app/.env or ./app/.env.local.dist) and install the PHP dependencies :

user@host symfony-demo$ docker compose run --rm app composer install -o [--no-dev]

The "--no-dev" option is for the production environment.

For the development and the test environments only :

user@host symfony-demo$ docker compose run --rm app phive install --trust-gpg-keys 4AA394086372C20A,12CE0F1D262429A5,31C7E470E2138192,8AC0BAA79732DD42,C5095986493B4AA0

Creating the database

user@host symfony-demo$ docker compose run --rm app ./bin/console doctrine:database:create [-e test]
user@host symfony-demo$ docker compose run --rm app ./bin/console doctrine:migrations:migrate [--no-interaction] [-e test]

The "-e test" option is to for the test environment which uses Sqlite.

Serving assets in production

user@host symfony-demo$ docker compose run --rm app bin/console asset-map:compile

Usage

Once the installation is complete, you can start the containers with :

user@host symfony-demo$ docker compose up -d

The demo will be available in your browser through : http://127.0.0.1/index.php/

To stop the containers :

user@host symfony-demo$ docker compose down

Tests

First, you need to configure the app and create the database for the test environment. Then, run the tests :

user@host symfony-demo$ docker compose run --rm app ./tools/phpunit -c ./ci/phpunit.xml

The generated outputs will be in ./ci/phpunit/.

And, run the mutation tests :

user@host symfony-demo$ docker compose run --rm app ./tools/infection -c./ci/infection.json

The generated outputs will be in ./ci/infection/.

PHPDoc

To generate the PHPDoc, use this command after installing phive dependencies :

user@host symfony-demo$ docker compose run --rm app ./tools/phpDocumentor --config ./ci/phpdoc.xml

The generated HTML documentation will be in ./app/ci/phpdoc/.

About

This is a simple Symfony 7.0 demo project using PHP 8.3.

Resources

License

Stars

Watchers

Forks

Packages

No packages published