PHP support includes:
- Possibility to create PHP files and classes from templates.
-
Full PHP 5.6.x
syntax support.
-
Partial support for PHP 7
return type hints.
- Syntax highlighting.
- Error highlighting.
- Basic on-the-fly code completion.
-
Resolution of
includestatements and file references, including references toPHARarchives.All the
PHARfiles from the current project and the specified include path are shown in the project tool window under the Project View/Libraries/PHAR node and available for browsing right there. - Class Completion.
- Intention actions and quick fixes.
- Surrounding with code constructs ⌥⌘J or ⌥⌘J⌥⌘J or ⌥⌘J⌥⌘J or ⌥⌘J^ ⌥ J, ⌃⌥J or ⌃⌥J^ ⌥ J, ⌃⌥J or ⌃⌥J and ⌥⌘T or ⌥⌘T⌥⌘T or ⌥⌘T⌥⌘Z or ⌥⌘Z^ ⌥ T, ⌃⌥T or ⌃⌥T^ ⌥ T, ⌃⌥T or ⌃⌥T.
- Code inspections.
- Jump to declaration (⌘B, ⌘Button1 Click, Button2 Click, ⌘B, ⌘Button1 Click or Button2 Click⌘B, ⌘Button1 Click, Button2 Click, ⌘B, ⌘Button1 Click or Button2 ClickF3, ⌃Button1 Click, F3 or ⌃Button1 ClickF12, ⇧ F2, ^ B, ^ Button1 Click, Button2 Click, F12, ⇧F2, ⌃B, ⌃Button1 Click, Button2 Click, F12, ⇧F2, ⌃B, ⌃Button1 Click or Button2 Click^ ⌥ G, Escape, Period, ⌥ Period, ^ Button1 Click, ⌃⌥G, ⎋, ., ⌥., ⌃Button1 Click, ⌃⌥G, ⎋, ., ⌥. or ⌃Button1 Click).
- Refactoring:
PHP development support is provided through the PHP plugin.
The plugin is not bundled with IntelliJ IDEA, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
This part describes some procedures that are specific for developing PHP applications and some preliminary steps that are required to configure PHP development environment.
Follow these general steps:
- Configure the PHP development environment.
- Enable PHP support in IntelliJ IDEA.
-
Start creating a project from scratch. On the first page
of the New Project wizard, select Static Web.
To run and debug your application on a local Web server, create the project root below the Web server document root. Thus your application sources will be "visible" for the local Web server.
- Create and configure the required data sources (see Managing Data Sources).
- Populate the application using provided coding assistance.
-
Deploy the application.
With IntelliJ IDEA, you can flexibly configure deployment of PHP applications. For example, you can set up your PHP project on a local Web server from the very beginning, or develop and test an application locally and then upload it to a remote Web server, etc.
-
Run the application. You can do it in several ways:
- From IntelliJ IDEA using a run configuration of the type PHP Web Application to view application output in a browser.
- From IntelliJ IDEA using a PHP Console run configuration to view the application output in the Run tool window.
- From IntelliJ IDEA, using a built-in Web server. This approach saves your time and effort because you do not need to deploy the application sources.
The following optional steps may be helpful:
- Set up unit testing in your project.
- Install and configure a debugging engine and specify the debugger options.
- Debug the application.
- Enable and use integration with PHP-specific command line tools.