Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Setting up a PHP development checkout

A working checkout for PHP work on Exponential - clone, Composer, a SQLite installation, the dev environment name, the development tools in .devtools/, the git hooks, debug settings and the commands you run every day.

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/help/php-developers/a-php-development-checkout.md

On this page

Setting up a PHP development checkout

This page is for PHP developers who want a checkout of Exponential to write and test PHP code in: kernel fixes, extensions, tests. It goes a step further than the application creators' setup page (Setting up a development environment): the development tools, the git hooks and a PHP 8.0 binary for compatibility checks.

Contents

  1. What you need
  2. Clone and install
  3. Name the environment
  4. The development tools
  5. The git hooks
  6. A PHP 8.0 binary
  7. Debug settings for development
  8. Daily commands

What you need

ToolWhy
PHP 8.0 or newer on the command linethe kernel supports 8.0 to 8.5; PHPUnit 13 in the installed vendor/ needs 8.4
Composer 2the dependencies and the development tools
Gitthe hooks and the change-based checks compare against origin/main
Node.js (optional)node --check of changed JavaScript in the pre-commit hook
A second PHP, 8.0 (optional)make lint80, the oldest supported syntax

Clone and install

git clone https://github.com/se7enxweb/exponential.git exp-dev
cd exp-dev
composer install
php bin/php/console exp:install --apply --package=sevenx_multisite_clean --url=http://127.0.0.1:8088

composer install runs bin/php/ezpgenerateautoloads.php afterwards ("post-install-cmd" in composer.json). The install uses SQLite unless you pass --db= (The console install). Reinstall with --force when you need a clean state.

Name the environment

Copy config.env.php.example to config.env.php and set the environment name of this machine:

<?php
define( 'EXP_ENV', 'dev' );

With dev (or test), index.php shows PHP errors in the browser, and eZINI also reads a variant of every settings file with the name after .ini, for example settings/override/site.ini.dev.append.php, after the standard file of the same layer. Each environment has its own INI cache. config.env.php is listed in .gitignore; never commit it.

The development tools

make devtools   # PHP_CodeSniffer, PHPCompatibility and PHPStan into .devtools/ (composer.dev.json), never into vendor/

The tools are resolved for PHP 8.0.30 from composer.dev.json, so they run on every supported PHP. After this, .devtools/vendor/bin/phpcs and .devtools/vendor/bin/phpstan exist and the make targets use them (Git hooks and make targets).

The git hooks

make hooks      # git config core.hooksPath .githooks
HookChecks
pre-commitphp -l of staged PHP files, PHP 8.0 syntax when a PHP 8.0 binary is found, node --check of staged JavaScript, the file manifest, the code style of staged PHP files
commit-msgthe subject starts with Added: , Updated: , Fixed: , Removed: or Renamed:
pre-pushPHPStan against the baseline

Without make devtools the hooks still check syntax, the manifest and the message, and skip code style and PHPStan with a hint.

A PHP 8.0 binary

PHP 8.0 is the oldest supported version (the stock PHP of RHEL 9); PHP 7.4 is usable without support (make lint74 checks it). The pre-commit hook and make lint80 find PHP 8.0 as EXP_PHP80, php8.0 or php80 on the PATH, or /opt/plesk/php/8.0/bin/php:

make lint80                                   # PHP 8.0 syntax of the files changed since origin/main
make lint80-all PHP80=/path/to/php8.0         # every PHP file in git, as CI runs it

Without one, CI's php80 job is your only PHP 8.0 check (Writing code that runs on PHP 8.0).

Debug settings for development

In settings/override/site.ini.append.php of the development machine only:

[DebugSettings]
DebugOutput=enabled

[TemplateSettings]
DevelopmentMode=enabled
ShowTemplatePathComments=enabled

The debug bar then shows queries, templates, timings and settings for each page (The debug bar for PHP developers). Put these lines in a site.ini.dev.append.php instead, and they can never reach a machine whose environment is not dev.

Daily commands

CommandWhen
php -l <file.php>after every edit
php bin/php/ezpgenerateautoloads.php -eafter adding, renaming or moving an extension class
php bin/php/ezcache.php --clear-tag=iniafter a settings change
php bin/php/ezcache.php --clear-allafter a class or template path change, when output looks stale
vendor/bin/phpunit <test file>the tests of what you changed
make checksyntax, manifest, code style and PHPStan before you push
php bin/php/console exp:velocity deployunder Velocity: autoloads, caches, workers, in the right order

Add --allow-root-user to the cache and console commands only when you work as root.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x