Skip to content

Development Aids

Tom Udding edited this page Jan 1, 2024 · 22 revisions

Makefile

To aid the development process, several development aids are included in the Makefile.

Firstly, make sure your environment is set up correctly by coping .env.dist to .env as described in Docker Deployment.

You can now use the following commands from the Makefile as well:

  • make phpcbf before committing to beautify your changes according to the PSR1 and PSR12 standards.
  • make phpcsfix to beatify all project code.
  • make phpcsfixrisky to beatify all project code and apply functional changes like typing. This may change functionality and/or introduce bugs. Use this with caution.
  • make phpstan to perform a static code analysis to find probable bugs.

Installing PHP

On Linux or inside WSL, you can run the following to install PHP and all neccesary extensions:

sudo apt install -y php8.3-{cli,curl,gd,intl,imagick,mbstring,opcache,memcached,mysql,xml,pgsql,zip,xdebug}

OR

sudo apt install -y php-{cli,curl,gd,intl,imagick,mbstring,opcache,memcached,mysql,xml,pgsql,zip,xdebug}

Installing non-default PHP versions

Ubuntu may not ship with the currently used PHP version. To install another version you can add add a repository that contains them as follows:

apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update

Installing dependencies.

You can now run php composer.phar install -o --ignore-platform-reqs

Git hooks

If you want, you can run make phpcbf || true automatically when you commit by adding a git hook. You can easily do so by running

echo "make phpcbf" > .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit