magento2-phpstorm-plugin
magento2-phpstorm-plugin copied to clipboard
PHPStorm Plugin for Magento 2
PhpStorm Magento 2 Plugin
Installation
- Go to
Settings > Preferencesin the PhpStorm IDE - Navigate to
Plugins - Click the
Browse repositories...button and search for "Magento PhpStorm" - Install the plugin and restart PhpStorm
- Go to
Settings > Preferences > Languages & Frameworks > PHP > Frameworks > Magentoin the PhpStorm IDE - Check
Enableand click theOKbutton
Works with
- PhpStorm >= 2021.2.1
- JRE >= 11
Features
- Configuration smart completion and references for XML/JavaScript files
Navigate to configurationreference in scope of class/interfaceGo to pluginreference in scope of class/interface and methodNavigate to Web API configurationreference in scope of class/interface and method- Plugin class methods generation
- Plugin declaration inspection
- RequireJS reference navigation and completion
- MFTF reference navigation and completion
- GraphQL navigation line markers
- Code generation
- Inspections for XML configuration
Setting up development environment
- Check out this repository
- Open a folder with the project in the IntelliJ Ultimate using the
openaction button. - Make sure that you on the latest develop branch (e.g
4.4.0-develop) - Right-click on the
build.gradlefile, choose "Import Gradle project" (if this is not exist look for "Build module ''") (you need to have Gradle plugin installed) - Check if the right SDK version is used for the project.
- Current Java version for the project is java 11, so you should additionally download SDK 11 and choose it in the module settings:
Right click by the project root > Open Module Settings > Project Settings > Project > Project SDK - Check if right SDK version is used for the Gradle plugin:
Intellij IDEA > Preferences... > Build, Execution, Deployment > Build Tools > Gradle > Gradle JVMand choose your JDK.
- Current Java version for the project is java 11, so you should additionally download SDK 11 and choose it in the module settings:
- When the Gradle sections appeared in the right bar, navigate there and right-click
magento-2-php-storm-plugin > Tasks -> Intellij -> runIde - Click
Run "magento-2-php-storm-plugin"to run the plugin. You should see a new instance of IntelliJ launched with the plugin installed. Make sure the plugin is enabled in IntelliJ settings and indexing is finished. Plugin features should be accessible at this point.
How to contribute
- Start with looking into Community Backlog. Any ticket in
Ready for DevelopmentandGood First Issuecolumns are a good candidates to start. - Didn't satisfy your requirements? Create a new issue. It can be for example:
- Bug report - Found a bug in the code? Let us know!
- Enhancement - Know how to improve existing functionality? Open an issue describe how to enhance the plugin.
- New feature proposal - Know how to make a killer feature? Do not hesitate to submit your proposal.
- The issue will appear in the
Ready for Groomingcolumn of the Community Backlog. Once it will be discussed and approved the issue will be ready for development. - Refer to the Contributing Guide for more information on how to contribute.
How to create SandBox for development
- Create sandbox folder
- Copy to sandbox folder
composer.jsonandcomposer.lock - In sandbox folder create
app/codeandvendor/magento - Copy any of the magento modules (as for example:
framework,module-catalog,module-checkout,module-customer,module-sales) into thevendor/magentofolder. It is better to add as few modules as possible to reduce reindexing time during application running - (Nice to have) Open IDE and go to
Preferences > Editor > File and Code Templates > Includes taband add default headers forPHP File HeaderandXML File Header
PHP File Header:
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
XML File Header:
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
Join the #phpstorm-plugin Slack channel to get more involved
License
Each Magento source file included in this distribution is licensed under OSL-3.0 license.
Please read the LICENSE.txt for the full text of the Open Software License v. 3.0 (OSL-3.0).