![]() Otherwise, the Wordpress bootstrapping process will be skipped, and the execution will fail. ![]() To debug a command, it is crucial that you initiate a debugging session for the command itself, and not the controller class or the file it is defined in. Wordpress commands are defined in controller classes that extend WP_CLI_Command, as well as in arbitrary functions. ![]() The command execution result is displayed in the Run tool window. In the Run Anything window that opens, type the call of the command in the format. Go to Tools | Run Command or press Control twice. You can run WP-CLI commands and analyze their output right in PhpStorm, just as the commands of any other command line tools, refer to PHP command line tools. For more information, refer to Customize a tool. Optionally, click to edit the tool properties, or to customize the commands set. Type the path manually or click and choose the desired location in the dialog that opens.Ĭlick OK to apply changes and return to the PHP Command Line Tool Support page. If you used Composer, the default location is \vendor\wp\cli\bin\wp or \vendor\wp\cli\bin\wp.bat. In the Path to wp.bat field, specify the location of the wp.bat or wp executable file. Type the path manually or click and choose the desired location in the dialog that opens.Įxecutable available (installed via Composer, and so on): choose this option to launch WordPress through an executable file, which is available when you install WordPress using a package management tool, for example, Composer. In the Path to phar field, specify the location of the wp-cli.phar archive. For more information, refer to Configure local PHP interpreters and Configure remote PHP interpreters. Installed via PHAR: Choose this option to launch WordPress through a PHP script or have PhpStorm detect and start the launcher in the wp-cli.phar archive.Ĭhoose one of the configured PHP interpreters from the PHP Interpreter list. When you click OK, the WP-CLI dialog opens. In the Command Line Tools dialog, choose WP-CLI from the list, and specify its visibility level ( Project or Global). In the Settings dialog ( Control+Alt+S), go to Tools | PHP Command Line Tool Support. Using WP-CLI as a PhpStorm command line toolīefore you begin, download the wp-cli.phar at WordPress CLI. Press Alt+Enter and select whether you want to install a specific dependency or all dependencies at once. If the Non-installed Composer packages inspection is enabled, PhpStorm will highlight the declared dependencies that are not currently installed. Press Control+Space to get code completion for the package name and version.Ĭlick the Install shortcut link on top of the editor panel. Inside composer.json, add the wp-cli/wp-cli dependency record to the require or require-dev key. After that, the created PhpStorm project opens. As a result, the Composer project will be created, whose configuration and structure depend on the selected package. The create-project Composer command will be invoked with the selected package. Installing the WP-CLI package using the Composer dependency managerīefore you start, make sure Composer is installed on your machine and initialized in the current project as described in Composer dependency manager.Ĭlick Create. Note that WordPress requires PHP 5.3 or later. If the plugins are disabled, enable them on the Installed tab of the Plugins page as described in Install plugins.Ĭonfigure the PHP interpreter to use WordPress with, as described Configure remote PHP interpreters. Make sure the PHP and Command Line Tool Support plugins are installed and enabled. Make sure the PHP interpreter is configured in PhpStorm on the PHP page, as described in Configure local PHP interpreters and Configure remote PHP interpreters. The downloaded command line tool must be registered in PhpStorm as described in PHP command line tools.įor more information about running the tool in the command line mode, refer to PHP command line tools. To run WordPress in the command line mode, you will need a set of command line tools, which you can acquire by installing the wp-cli/wp-cli package using the Composer dependency manager or by downloading the wp-cli.phar archive.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |