Answers.Body: <p>I point <code>File-&gt;Open Directory</code> at <code>craft/..</code>, and PhpStorm pick up everything for me. You probably have to set up path mappings to make debugging work properly, but PhpStorm will alert you to that and launch the mapping UI.</p>
  
  <p>I have a sandbox Craft install running at <code>local.sandbox.dev</code> and I create a git repo in the <code>plugins</code> directory, and develop the plugin in there. That way I can have multiple plugins in this sandbox, all with different repos, whereas the Craft install itself is not version controlled. Makes it easy also to dump the entire installation and replace it whenever the database becomes too mangled.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-03T00:59:42.613Z
Answers.Text: You got me started, and I followed the instructions here: http://manovotny.com/setup-phpstorm-xdebug-mamp-debugging/ and debugger is working as well.
Answers.UserDisplayName: Marion Newlevant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-31T10:21:41.270Z
Answers.LastActivityDate: 2015-07-31T10:21:41.270Z
Answers.UserDisplayName: megatrond
Answers.Body: <p>I've never actually used the PhpStorm new project wizard, but I believe what it's asking is:</p>
  
  <ol>
  <li>Are your source repo files <em>also</em> where your web server is pointing when you go to <code>yourdomain.com</code>?</li>
  </ol>
  
  <p>OR</p>
  
  <ol start="2">
  <li>Do you have a source repo directory and a separate sites directory where your web server is pointing for <code>yourdomain.com</code>? In this scenario you'd need to copy over the source repo files to the site directory manually or setup a way to sync them.</li>
  </ol>
  
  <p>A common plugin development scenario is more of a modification of the 2nd option.  You'll have a source repo with your plugin files in it and a separate Craft installation that <code>yourdomain.com</code> points to, but from the <code>craft/plugins</code> folder your make a symlink to your plugin repo so that you can make changes directly in the repo and immediately test them on the site.</p>
  
  <p>But I wouldn't bother using the new project wizard at all.  Just open the source repo using <code>File-&gt;Open Directory</code> and setup everything up externally.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-31T06:17:05.780Z
Answers.Text: I have the plugin source in `craft/plugins/myplugin`. I think I am confused about the source repo vs the webroot.  My webserver is pointing to `public`, but craft is in `../craft`. Do I point `File->Open Directory` at `craft`? at `public`? at `craft/..`?
Answers.UserDisplayName: Marion Newlevant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-31T16:19:13.460Z
Answers.Text: Sorry, when I say source repo, I'm assuming something like a GitHub source repo, where the plugin is under source control.  Maybe you've got the whole site under source control and you're including the plugin in that?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-31T17:46:41.623Z
Answers.Text: I'm not even worrying about the source control part of the puzzle yet.
Answers.UserDisplayName: Marion Newlevant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-31T03:34:37.777Z
Answers.LastActivityDate: 2015-07-31T03:34:37.777Z
Answers.UserDisplayName: Brad Bell
Body: <p>Can someone explain how to set up PhpStorm so that I can use it to develop/debug a plugin? I have</p>
  
  <ul>
  <li>local webserver set up</li>
  <li>craft files in the usual place above the webroot</li>
  </ul>
  
  <p>The new project wizard gives me a choice between <strong>"Web server is installed locally, source files are located under its document root"</strong> and <strong>"Web server is installed locally, source files are located elsewhere locally. (Source files are copied to project root, then synchronized with server when necessary.)"</strong> Neither of which seems quite right.</p>
  
  <p>Directory structure:</p>
  
  <ul>
  <li>craft
  
  <ul>
  <li>app</li>
  <li>plugins
  
  <ul>
  <li>myplugin</li>
  </ul></li>
  </ul></li>
  <li>public &lt;== this is webroot
  
  <ul>
  <li>.htaccess</li>
  <li>index.php</li>
  </ul></li>
  </ul>
  
Tags: <plugin-development><debugging>
Title: How do I set up PhpStorm for plugin development
ThreadText: # How do I set up PhpStorm for plugin development
  
  (Asked by: username_0 on 2015-07-30)
  
  Can someone explain how to set up PhpStorm so that I can use it to develop/debug a plugin? I have
  
  * local webserver set up
  * craft files in the usual place above the webroot
  
  The new project wizard gives me a choice between **"Web server is installed locally, source files are located under its document root"** and **"Web server is installed locally, source files are located elsewhere locally. (Source files are copied to project root, then synchronized with server when necessary.)"** Neither of which seems quite right.
  
  Directory structure:
  
  * craft
    + app
    + plugins
      - myplugin
  * public <== this is webroot
    + .htaccess
    + index.php
  
  **Tags:** plugin-development, debugging
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-07-31. Score: 3 | Accepted answer
  
  I point `File->Open Directory` at `craft/..`, and PhpStorm pick up everything for me. You probably have to set up path mappings to make debugging work properly, but PhpStorm will alert you to that and launch the mapping UI.
  
  I have a sandbox Craft install running at `local.sandbox.dev` and I create a git repo in the `plugins` directory, and develop the plugin in there. That way I can have multiple plugins in this sandbox, all with different repos, whereas the Craft install itself is not version controlled. Makes it easy also to dump the entire installation and replace it whenever the database becomes too mangled.
  
  > **Comments:**
  > **username_0**: You got me started, and I followed the instructions here: http://manovotny.com/setup-phpstorm-xdebug-mamp-debugging/ and debugger is working as well.  
  
  ---
  
  ### Answer by username_2 on 2015-07-31. Score: 1
  
  I've never actually used the PhpStorm new project wizard, but I believe what it's asking is:
  
  1. Are your source repo files *also* where your web server is pointing when you go to `yourdomain.com`?
  
  OR
  
  2. Do you have a source repo directory and a separate sites directory where your web server is pointing for `yourdomain.com`? In this scenario you'd need to copy over the source repo files to the site directory manually or setup a way to sync them.
  
  A common plugin development scenario is more of a modification of the 2nd option. You'll have a source repo with your plugin files in it and a separate Craft installation that `yourdomain.com` points to, but from the `craft/plugins` folder your make a symlink to your plugin repo so that you can make changes directly in the repo and immediately test them on the site.
  
  But I wouldn't bother using the new project wizard at all. Just open the source repo using `File->Open Directory` and setup everything up externally.
  
  > **Comments:**
  > **username_0**: I have the plugin source in `craft/plugins/myplugin`. I think I am confused about the source repo vs the webroot.  My webserver is pointing to `public`, but craft is in `../craft`. Do I point `File->Open Directory` at `craft`? at `public`? at `craft/..`?  
  > **username_2**: Sorry, when I say source repo, I'm assuming something like a GitHub source repo, where the plugin is under source control.  Maybe you've got the whole site under source control and you're including the plugin in that?  
  > **username_0**: I'm not even worrying about the source control part of the puzzle yet.  
  
  ---
  
  