Development Workflow

Setting Up a Local PHP Development Environment

Prepare a local PHP environment with a compatible runtime, database, extensions, Composer, and a safe configuration workflow.

Install a compatible PHP runtime

Choose a PHP version supported by your application and close to the production environment. Confirm the executable:

php -v
php --ini

When multiple PHP versions are installed, make sure your terminal and development server use the intended binary.

Install required extensions

Check the project's requirements and inspect loaded modules:

php -m

Common requirements include a database driver such as pdo_mysql, plus extensions such as mbstring, curl, fileinfo, and openssl when used by the application.

Set up the database

Create a dedicated local database and user. Import a development schema or run the project's migrations. Do not use production credentials for local development.

Install Composer dependencies

composer install

Commit the lock file so the project uses consistent dependency versions.

Run PHP's built-in development server

From the project directory:

php -S 127.0.0.1:8000 -t public

This server is intended for development, not production hosting.

Keep environments separate

Use separate configuration for local, staging, and production. Exclude secret files from Git, and use test data rather than real customer information.