PHP Development

Getting Started with JetBrains PhpStorm for PHP

Configure PhpStorm for PHP development with a CLI interpreter, Composer, project indexing, inspections, tests, and version control.

PhpStorm provides an integrated PHP workflow, but it still needs to be connected to the correct runtime and project configuration.

This guide focuses on a plain PHP workflow and can be adapted to framework-based projects where the same tools apply.

Open a project and configure PHP

Open the repository root and navigate to Settings | PHP. Add a local CLI interpreter that points to the PHP executable used by the project. Confirm the detected PHP version and configuration file. Set the language level to match the project’s supported PHP version.

Connect Composer and dependencies

Configure Composer using the project’s Composer executable and composer.json. Install dependencies from the lock file. PhpStorm can use Composer metadata for navigation and code completion, but missing or stale dependencies still need to be corrected from the terminal.

Use navigation and refactoring

Explore Go to Declaration, Find Usages, class hierarchy, safe rename, and refactoring tools on a representative code path. Review the proposed changes before applying broad refactors. Run tests and inspect the diff after a rename that affects namespaces, routes, templates, or configuration.

Configure inspections and formatting

Review PHP inspections and code-style settings. Import a shared code-style configuration when the team has one. Avoid allowing individual IDE preferences to silently conflict with the repository’s formatter or CI checks.

Connect tests and version control

Configure PHPUnit using the project’s test configuration and interpreter. Verify that Git uses the expected repository and that ignored files such as local environment configuration are not staged. Run the same test and static-analysis commands that CI runs.

Practical verification checklist

  • Confirm the editor uses the intended PHP 8.4 executable.
  • Open the repository root and verify Composer dependencies.
  • Run PHP linting and the project’s automated tests.
  • Check that editor diagnostics match command-line results.
  • Keep local credentials and production data out of the workspace.

Conclusion

A good PhpStorm setup mirrors the project rather than imposing a private environment. Configure the interpreter, Composer, inspections, tests, and Git once, then keep those settings aligned with team conventions.

Official documentation

Share this page Help other developers discover this resource.