Skip to content

Development Environment ​

Requirements ​

  • PHP with the zip, dom and fileinfo (and optionally apcu, memcached, redis) extensions
  • NPM for front end asset serving and bundling
  • Docker and Docker Compose for running the local development container
  • Git for version control

Instructions ​

WARNING

These instructions are for setting up a local DEVELOPMENT environment. If you are looking for basic installation instruction see the Installation page instead.

  1. Fork the Directory Lister repository to your own account (optional)

  2. Clone Directory Lister to a local repository

    bash
    git clone https://github.com/DirectoryLister/DirectoryLister.git
  3. Switch to the Directory Lister directory

    bash
    cd /path/to/DirectoryLister
  4. Install and build PHP and JavaScript dependencies

    bash
    composer install
    npm install
  5. Run the local Docker container

    bash
    docker-compose up -d

You should now be able to access your local Directory Lister installation at http://localhost.

Common Development Commands ​

Many common development actions have been defined in the Makefile and can be run with make command.

Clear the application cache ​

sh
make clear-cache
sh
rm --recursive --force app/cache/*

Clear built assets ​

sh
make clear-assets
sh
rm --recursive --force app/assets/*

Run test suite ​

sh
make test
sh
composer exec phpunit
sh
app/vendor/bin/phpunit

Check or fix coding standards ​

Make

sh
make coding-standards

INFO

This checks coding standards and reports problems without modifying files.

See the Composer or Manual tab to automatically apply coding standard fixes.

Composer

sh
composer exec php-cs-fixer fix [--diff] [--dry-run]

TIP

If no flags are present, coding standard fixes will be automatically applied.

To report coding standard problems without modifying files use the --dry-run flag.

Additionally, to display a diff of the fixes that would be applied, use the --diff flag as well.

Manual

sh
app/vendor/bin/php-cs-fixer fix [--diff] [--dry-run]

TIP

If no flags are present, coding standard fixes will be automatically applied.

To report coding standard problems without modifying files use the --dry-run flag.

Additionally, to display a diff of the fixes that would be applied, use the --diff flag as well.

Perform static analysis ​

sh
make static-analysis
sh
composer exec phpstan analyze
sh
app/vendor/bin/phpstan analyze

Generate code coverage report ​

sh
make coverage
sh
XDEBUG_MODE=coverage composer exec phpunit --coverage-html .coverage
sh
XDEBUG_MODE=coverage app/vendor/bin/phpunit --coverage-html .coverage

IMPORTANT

Code coverage requires a code coverage engine (e.g. xdebug or pcov) to run.