fra-c / slim-doctrine-behat-skeleton
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.1.0
- doctrine/migrations: ^1.8
- doctrine/orm: ^2.6
- monolog/monolog: ^1.23
- slim/slim: ^3.10
- vlucas/phpdotenv: ^2.5
Requires (Dev)
- behat/behat: ^3.5
- phpunit/phpunit: ^7.3
This package is not auto-updated.
Last update: 2025-05-12 17:55:53 UTC
README
Skeleton application using Slim 3 with Doctrine ORM and Behat. It also features migrations.
The following instructions assume you're using Docker.
Install
Run the following command to create the project (replace [my-app-name]):
$ docker run -it --rm -v $(pwd):/app composer create-project fra-c/slim-doctrine-behat-skeleton [my-app-name]
Create an .env
file and edit to your needs:
$ cp .env.example .env
Implement the health check based on your needs.
Run tests
Run Behat tests with:
docker-compose run --rm -e DB_NAME=test_db -e LOG_FILENAME= php vendor/bin/behat
WARNING: When you run tests, the database specified in DB_NAME
will be dropped and recreated. If you don't specify DB_NAME
in the command, the .env
file or environment variables will be used. DO NOT USE production credentials.
Composer command
To run composer:
docker run -it --rm -v $(pwd):/app composer [command] [options] [...]
Example:
docker run -it --rm -v $(pwd):/app composer require --dev phpunit/phpunit
Migrations
Creating migrations
Edit the Doctrine mapping yaml files as needed then run the following command to create a migration file:
docker-compose run --rm php vendor/bin/doctrine-migrations migrations:diff
Migrating
Tests run migrations automatically before every scenario.
To update the local database instead run:
docker-compose run --rm php vendor/bin/doctrine-migrations migrations:migrate