This application manages tasks as a kind of simple "to do list".
It is only accessible with a user account, and obviously he has to be authenticated!
- An anonymous user (visitor) is automatically redirected to login page.
- An authenticated user is redirected to application homepage after successful login action.
- A disconnected user is redirected to login page again.
Task features:
- Each task is associated to a single author.
- Each task is updated by a single last editor.
- A task without author was considered created by an "anonymous author" (user).
- A task author, if one exists, is definitely set after creation.
User features:
- An authenticated user can only manage tasks.
- An authenticated user can list all tasks with or without a "isDone" state filter, and then access a particular dedicated list.
- An authenticated user can create any tasks.
- An authenticated user can toggle any tasks "isDone" state by marking selected one as "done/undone".
- An authenticated user can update (edit) any tasks as last editor.
- An authenticated user can only delete his own created tasks.
Administrator features:
- An authenticated administrator (admin) can also manage other registered users.
- An authenticated administrator benefits from the same user permissions on tasks.
- An authenticated administrator can list all users accounts.
- An authenticated administrator can create another user account and define his roles (user, admin).
- An authenticated administrator can update all users accounts and redefine his roles.
- An authenticated administrator can delete all users accounts.
Faker PHP library (in order to add custom data fixtures)
Doctrine test bundle (in order to manage automated tests and easily rollback database transaction)
Local installation (can be used on deployment with ssh access with some adaptations for environment variables)
$ git clone https://github.com/sjeguedes/symfonyTDAC.git
2. Configure project needed particular data and your own database parameters with environment variables in env.local
file using .env
provided example file:
Prefer use a env.<your_environment>.local
file per environment combined to env.local.php
to manage each environment.
# Application environnement and secret
APP_ENV=your_environment # e.g. "dev", "test" or "prod"
APP_SECRET=your_secret
# Database configuration (example here with MySQL)
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
3. Adapt Doctrine "dbal" section configuration (driver and server_version) to your system requirements in config/packages/doctrine.yaml
file if needed:
For instance, this is needed if you use another driver such as PostgreSQL, MariaDB, etc... instead of MySQL.
# Development (dev) environment
$ composer install
# Production (prod) environnement
$ composer install --no-dev --no-scripts --optimize-autoloader
# Create database
$ php bin/console doctrine:database:create
# Create schema
$ php bin/console doctrine:migrations:migrate
$ php bin/console doctrine:fixtures:load
# or add "-n" option to avoid console interactivity
$ php bin/console doctrine:fixtures:load -n
Please note that 3 automated test suites were made with PHPUnit test framework, to maintain this project correctly.
You can have a look at tests
folder divided in 3 sub folders (Unit, Integration, Functional) and env.test
example file:
For local installation:
# You can or simply use option "--env=test" for each command or switch to "test" environnement
and install "test" particular database thanks to ".env.test.local" file configuration.
# e.g. with ".env.local.php"
$ composer dump-env test
# Then follow the same process as above to create "test" database and generate fixtures for this environment.
# Execute all existing test suites after "test" environnement installation:
$ php bin/phpunit
# or to be more explicit:
$ php bin/phpunit tests
# or:
$ php bin/phpunit --testsuite 'Project Tests Suite'
# Execute only unit test suite:
$ php bin/phpunit tests/Unit
# or:
$ php bin/phpunit --testsuite 'Project Unit Tests Suite'
# Execute only integration test suite:
$ php bin/phpunit tests/Integration
# or:
$ php bin/phpunit --testsuite 'Project Integration Tests Suite'
# Execute only functional test suite:
$ php bin/phpunit tests/Functional
# or:
$ php bin/phpunit --testsuite 'Project Functional Tests Suite'
You can have a look at phpunit.xml.dist
example file located in project root folder, to manage PHPUnit configuration
PHPUnit current documentation:
If you are interested in improving this project you can follow our guidelines defined in Contributing file.
You are welcome to make this application evolve.