Minimal PHP support for IntelliJ IDEA Community, which does not bundle the paid
PhpStorm language plugin. Built the same way as ../jenkinsfile-plugin
(IntelliJ Platform Gradle Plugin 2.x, Kotlin).
- Portable PHP SDK + manager (
sdk/,settings/) — aSdkType+SdkDownload, the same mechanism the IDE uses for JDKs. Manage interpreters from a dedicated panel: Settings ▸ Languages & Frameworks ▸ PHP Interpreters — Download PHP…, Add from Disk…, Remove (optionally deleting files), Open Folder. Downloads land in~/.php-portable. (Also available via Project Structure ▸ SDKs ▸ Download.) - Run PHP script (
run/) — a run configuration that executes a.phpfile with the selected PHP SDK (or an explicit interpreter path). - Syntax highlighting (
lang/) — a lightweight, lexer-based highlighter for.phpfiles (tags, keywords, strings, comments,$variables, numbers).
cd php-portable
./gradlew runIde # launches a sandbox IDEA Community with the plugin loadedThen:
- Open
examples/hello.php→ see highlighting. - Project Structure ▸ SDKs ▸ + ▸ Download PHP → download a portable PHP.
- Run ▸ Edit Configurations ▸ + ▸ PHP Script → pick the SDK +
hello.php, Run.
- Verified to compile against IntelliJ IDEA Community 2024.1 (
./gradlew compileKotlin). - Build with a JDK ≤ 21. Kotlin 1.9.x's compiler crashes on JDK 24+ (
CoreJrtFileSystem). On this machine use the bundled JBR 17:(IntelliJ itself picks the right JBR automatically when you build from the IDE.)JAVA_HOME=~/Library/Java/JavaVirtualMachines/jbr-17.0.9/Contents/Home ./gradlew runIde
PhpDownloadsURLs are examples — patch versions go stale. Point them at current builds: Windows → windows.php.net; macOS/Linux → static-php-cli (dl.static-php.dev).SdkDownloadlives incom.intellij.openapi.roots.ui.configuration.projectRootand its callback isjava.util.function.Consumer(.accept(task)) — already wired.addBrowseFolderListeneris deprecated in newer platforms but still works; the non-deprecated replacement iswithTextBrowseButton/TextBrowseFolderListener.
- Semantic features (completion, go-to-def, inspections): wrap a PHP language server (Intelephense / phpactor) via LSP4IJ — the built-in IntelliJ LSP API is Ultimate-only and won't run in Community.
- Xdebug integration (DBGp) for debugging.
- Fetch the download catalog from a JSON manifest instead of hardcoding.
src/main/kotlin/io/genai/php/
lang/ PhpLanguage, PhpFileType, PhpTokenTypes, PhpLexer, PhpSyntaxHighlighter(+Factory)
sdk/ PhpSdkType, PhpRelease, PhpDownloads, PhpSdkManager, PhpInterpreterActions,
PhpSdkDownloadTask, PhpDownloadDialog
run/ PhpRunConfigurationType/Factory/Options/Configuration, PhpSettingsEditor,
PhpRunConfigurationProducer
settings/ PhpInterpretersConfigurable, PhpInterpreterSettings
statusbar/ PhpStatusBarWidget(+Factory)
notify/ PhpSetupNotificationProvider
src/main/resources/META-INF/plugin.xml, icons/php.svg
examples/hello.php
Apache License 2.0 © 2026 GenAI