PhpStorm 7.1.0 Web Help

To share your code, you can create gists right from PhpStorm. A gist can contain a code snippet, an entire file, several files, and even folders.

You can also use gists to save and share console output during running, debugging, testing, etc.

On this page:

Enabling creation of gists
  1. Make sure the GitHib plugin is enabled. The plugin is bundled with PhpStorm and activated by default. If it is not, enable the plugin.
  2. Create an account on the GitHub remote storage, and register this GitHub account in PhpStorm.
Saving code in a gist
  1. Select the code to be shared by doing one of the following:
    • To have a piece of code from a single file shared, open the file in the editor and select the required code snippet. If no selection is made, the gist will contain the entire file.
    • To have the code from a file shared, select the file name in the Project view.
    • To create a gist from a folder, select the folder in the Project view.
    • To create a gist from several files or folders, select them in the Project view.
  2. On the context menu of the selection, choose Create gist.
  3. In the Create Gist dialog box, that opens, provide a brief description of the gist to be created.
  4. Configure the gist's visibility.
    • By default, the new gist will be public, that is, visible for all registered users with your login displayed as owner. To accept this default behaviour, just click OK.
    • To create a private gist that will be available for you only, select the Private check box.
    • To make the gist available for all registered users without displaying your login, select the Anonymous check box.
  5. Specify whether you want PhpStorm to open the new gist in a browser or not:
    • To have the gist opened in the default PhpStorm browser so you can edit it right now, select the Open in browser check box. When you click OK, the https://gist.github.com/ page, that opens, shows the new gist with the selection or the entire contents of the current file. By default, the gist is named after the file the gist originates from. To update the code snippet, if necessary, click Edit.
    • If you do not want to open the gist right now, clear the Open in browser check box. PhpStorm displays the URL address of the gist so you you can access it later.
Saving console output in a gist
  1. During a run, debug, or test session, or when running commands in the command line mode, switch to the relevant tool window or tab that presents the output of the application or command.
  2. Click the right mouse button anywhere in the tab and choose Create Gist on the context menu.
  3. In the Create Gist dialog box, that opens, provide a brief description of the gist to be created and configure the gist's visibility.
  4. Specify whether you want PhpStorm to open the new gist in a browser or not.

See Also

Reference:

Version Control:

Web Resources: