Repository navigation
Development Environment
This section is for people who change KeyAnyWhere's code. This page builds on the Quick Start, which already gives you a running development install. It adds what development needs on top of that: the debugging tools, the test database, coverage support and the switches that only exist in development.
Finish the Quick Start. You then have the code, the development dependencies (composer install without --no-dev), both databases and config/.env.
KeyAnyWhere doesn't read an APP_ENV variable. It considers itself in development when all three are true: debug is on (DEBUG=true in config/.env), the file config/.env exists, and the request has a SERVER_NAME. Several behaviors depend on this:
| In development | In production |
|---|---|
| DebugKit toolbar loaded | not loaded |
CSRF cookie Secure-csrfToken
|
__Secure-csrfToken |
No Content-Security-Policy, no X-Frame-Options
|
both sent |
| Plain HTTP accepted | HTTPS only |
config/.env is loaded by config/bootstrap.php only when it exists and the process has no SERVER_NAME in its environment, and it never overrides a variable that is already set.
Code coverage and mutation tests (Code Quality) need a coverage driver. PCOV is the fastest:
sudo apt install -y php8.4-pcovphp -m | grep -i pcovTyping a 6-digit code on every login gets tedious. In development only, KeyAnyWhere can accept any code, if you opt in explicitly:
echo 'export DESENVOLVIMENTO_IGNORA_2FA="true"' >> config/.envThe switch only works when the environment is development and the variable is true: a production install copied from the examples could also have debug on and a config/.env, so the environment alone is not enough. The variable is deliberately left out of config/.env.example. The test suite never sets it, so 2FA is always tested for real.
If you skipped it in the Quick Start, ten example categories with twenty entries each make the screens easier to work with:
bin/cake seeds run CategoriasSeed,EntradasSeedStart the server and open http://localhost:8765/. With DEBUG=true, the DebugKit icon shows in the bottom-right corner of every page.
bin/cake serverphpstan.neon.dist and phpcs.xml.dist are the shared configurations of the checks. A local phpstan.neon or phpcs.xml (both ignored by Git) overrides them, for example to add a plugin's paths:
printf '%s\n' 'includes:' ' - phpstan.neon.dist' 'parameters:' ' paths:' ' - plugins/MyPlugin/src' > phpstan.neonSource code · Issues · Releases · Packagist · Online demo · Hosted edition
1. Getting started
2. Installing in production
- Overview
- Preparing the Server
- Installing KeyAnyWhere
- File Permissions
- Generating Security Keys
- Environment Variables
- Configuration Files
- Database Setup
- Insecure Password Catalog
- Web Server and HTTPS
- First-Run Setup
3. Operating your installation
4. Using KeyAnyWhere
5. Security
6. Development
7. Extending