URN highlighter

Overview of URN highlighter

Magento code references all XSD schemas as Uniform Resource Names (URNs). If you’re developing code and need to reference XSDs, this command configures your integrated developer environment (IDE) to recognize and highlight URNs. This makes development easier.

By default, an IDE like PHPStorm is not configured to recognize URNs and, as a result, they display in red text as follows:

The magento dev:urn-catalog:generate command enables your IDE (currently, only PHPStorm) to recognize and highlight URNs like the following:

Specifically, this command creates the following PHPStorm configuration:

First steps

  1. Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.

    If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:

    su <Magento file system owner> -s /bin/bash -c <command>
    

    If the Magento file system owner does not allow logins you can do the following:

    sudo -u <Magento file system owner>  <command>
    
  2. To run Magento commands from any directory, add <your Magento install dir>/bin to your system PATH.

    Because shells have differing syntax, consult a reference like unix.stackexchange.com.

    bash shell example for CentOS:

    export PATH=$PATH:/var/www/html/magento2/bin
    

You can also run the commands in the following ways:

  • cd <your Magento install dir>/bin and run them as ./magento <command name>
  • php <your Magento install dir>/bin/magento <command name>

<your Magento install dir> is a subdirectory of your web server's docroot. Need help locating the docroot? Click here.

Configure your IDE

Currently, only PHPStorm is supported.

Command syntax:

magento dev:urn-catalog:generate <path>

where <path> is the path to your PHPStorm misc.xml file, which is located relative to your project root. Typically, <path> is .idea/misc.xml