On this page:
- Creating an Empty PHP Project
- Creating a PHP Project from Existing Sources
- Choosing the PHP Interpreter and the Language Level Manually
Creating an Empty PHP Project
- Choose on the main menu or click the New Project button on the Welcome screen. The Project Category and Options dialog opens.
- In the left-hand pane, choose PHP, in the right-hand pane, choose PHP Empty Project, then click Next.
-
On the second page of the wizard:
- In the Project Name text box,
- In the Project Location text box, specify the path to the project folder where the project-related files will be stored.
-
In the PHP Language Level drop-down list,
specify the PHP functionality scope to get coding assistance for. Each functionality scope is associated with PHP version
that supports this functionality.
No correlation between the PHP version used in the project and the language level is enforced. Although the language version of each interpreter is detected automatically, you can still tell IntelliJ IDEA to provide you with coding assistance that corresponds to another language level. However, if you attempt to use a code construct that is not supported by the specified language level, IntelliJ IDEA suggests a Switch to PHP <version> quick-fix.
- From the Interpreter drop-down list, choose the PHP interpreter to use in the current project. The list contains all the currently configured local and remote PHP interpreters. See Configuring Local PHP Interpreters and Configuring Remote PHP Interpreters for details. You can also choose an interpreter or configure a new one later, see .
-
The Include Path area
shows a list of paths to PHP-related items
below the PHP home directory. The specified include paths will be used:
-
By the
require(),include(),fopen(),file(),readfile(), andfile_get_contents()functions when looking for files to use. - By IntelliJ IDEA when resolving references to included files.
Use the Add
and Remove
buttons to manage the contents of the list.
Use the Up
and Down
buttons to change the order of items in the list.
-
By the
See also Configuring PHP Namespaces in a Project
Creating a PHP Project from Existing Sources
Besides creating an empty PHP project, you can re-use your previously developed sources.
-
When the files to re-use are already on your machine, all you need is just open the folder where they are stored:
- On the main menu, choose .
- In the dialog box that opens, select the folder where the required sources are stored.
-
When the files to re-use are on a remote host:
- Configure synchronization with this remote host, see Configuring Synchronization with a Web Server.
- Download the sources to re-use, see Uploading and Downloading Files.
- Open the folder where the downloaded sources are stored and thus arrange them in a IntelliJ IDEA project. Alternatively, create an empty IntelliJ IDEA project and copy the downloaded source to it.
Choosing the PHP Interpreter and the Language Level Manually
To start PHP development in a project, you need to appoint one of the previously configured local or remote PHP interpreters to use and choose the PHP language level which determines the scope of PHP functionality to get coding assistance for. Currently PHP 5.3, PHP 5.4, PHP 5.5, and PHP 5.6 levels are supported.
To use PHP-related items from outside your project content root, configure include paths as described in Configuring Include Paths.
If you created your project through the New Project dialog, you have already specified the language level and possibly the interpreter and the include paths. However, if your project was created around some existing sources, you need to specify these settings manually.
- Open the Settings / Preferences Dialog by choosing for Windows and Linux or for OS X, and click PHP under Languages&Frameworks. Open the PHP page: choose and in the Preferences dialog box that opens, click PHP under Languages & Frameworks.
- In the PHP page that opens, choose the PHP installation to use from the Interpreter drop-down list.
-
To make sure that the configuration you have chosen points at the relevant installation,
click the Reload button
next to the drop-down list. If no PHP engine is actually installed at the specified directory, IntelliJ IDEA displays the corresponding error message.
- Click the Show phpinfo button to have IntelliJ IDEA display a separate information window where you can examine the installation details and view the list of loaded extension and configured options. Please note that the options specified in the Configuration Options field of the Interpreters dialog box are not listed.
-
To make sure that the configuration you have chosen points at the relevant installation,
click the Reload button
-
In the PHP language level drop-down list,
specify the PHP functionality scope to get coding assistance for. Each functionality scope is associated with PHP version
that supports this functionality.
No correlation between the PHP version used in the project and the language level is enforced. Although the language version of each interpreter is detected automatically, you can still tell IntelliJ IDEA to provide you with coding assistance that corresponds to another language level. However, if you attempt to use a code construct that is not supported by the specified language level, IntelliJ IDEA suggests a Switch to PHP <version> quick-fix.