Jump to content

Recommended PHP Editor or IDE?


pwuser1
 Share

Recommended Posts

I'm not sure if it's the 'best', but I use Netbeans, although the way Processwire is structured, some possible code completion isn't available, eg if you select a variable like $page, it can't give you a list of page fields, as they're defined in the database rather than in code.

With some other CMSs where you have to define a page class for the equivalent of each template in Processwire, you'd get access to those properties. It's not a biggie, as I generally know what fields I've defined for a template.

Netbeans has PHP documentation built in which can be handy.

  • Like 3
Link to comment
Share on other sites

5 hours ago, Kiwi Chris said:

With some other CMSs where you have to define a page class for the equivalent of each template in Processwire, you'd get access to those properties. It's not a biggie, as I generally know what fields I've defined for a template.

Just had an idea: what if we created a module that creates some kind of static file that the IDE can read listing all fields of a given template. Maybe we could also extend this module to parse all hooks even for properties that where added via a hook :)

does anyone need a challenge for christmas? :D

to your question, pwuser1 (welcome btw): some use phpstorm, some vscode, some sublime, some atom...

  • Like 6
Link to comment
Share on other sites

10 minutes ago, bernhard said:

ust had an idea: what if we created a module that creates some kind of static file that the IDE can read listing all fields of a given template. Maybe we could also extend this module to parse all hooks even for properties that where added via a hook

I am tempted to add this to Tracy :)

  • Like 8
Link to comment
Share on other sites

2 minutes ago, adrian said:

I am tempted to add this to Tracy :)

would be a perfect fit as every developer should use tracy anyhow :) no idea how different the IDEs work or how difficult that would be (i guess it should not be too hard?), but it would be great to support different IDEs of course. at least vscode :P

  • Like 2
Link to comment
Share on other sites

@bernhard I tried PHPStorm, Sublime Text but these paid editor does not offer siginificant advantages to Atom, VSCode, and even Brackets.  The issue with with the most unpaid one is which plugins to use for PHP some of them overlap.  So does anybody know how to setup Atom Editor for PHP and PW correctly?  If there is a better alternative to Atom please let me know.

  • Like 2
Link to comment
Share on other sites

31 minutes ago, codelearner said:

@bernhard I tried PHPStorm, Sublime Text but these paid editor does not offer siginificant advantages to Atom, VSCode, and even Brackets.  The issue with with the most unpaid one is which plugins to use for PHP some of them overlap.  So does anybody know how to setup Atom Editor for PHP and PW correctly?  If there is a better alternative to Atom please let me know.

there's a thread for phpstorm and vscode - feel free to open one for atom...

 

 

  • Like 1
Link to comment
Share on other sites

9 hours ago, pwuser1 said:

@Kiwi Chris does NetBeans  PHP debug  support conditional breakpoints?

Unfortunaely no. Netbeans integrates with Xdebug which does support conditional breakpoints, but somehow it hasn't made it into Netbeans yet even though it's been a feature request for years.

It seems like yet another open source project mismanaged by Oracle. Perhaps now Netbeans is moving to Apache there might be some progress on this.

  • Like 2
Link to comment
Share on other sites

If you want a free IDE with code completion and conditional breakpoints, it might be worth trying Visual Studio Code.

It's considered more an editor than a full blown IDE, but it supports intellisense (Microsoft's version of code-completion) and It's cross-platform, and unlike Netbeans, it does support Xdebug's conditional breakpoints and quite a bit more.

I think the full-blown Visual Studio supports PHP debugging too, but Visual Studio is a bit of a monster and Windows only, so you probably need to be using it for other development already to justify it.

  • Like 4
Link to comment
Share on other sites

On 12/16/2017 at 1:45 PM, pwuser1 said:

@codelearner mentioned Atom, any advantage of Atom vs VSCode @Kiwi Chris?

I haven't used Atom personally, but looking at the documentation, the PHP plugin looks like an early release and it doesn't mention debugging, but VSCode seems to support full debugging. Someone who's used Atom may be able to comment regarding debugging.

  • Like 1
Link to comment
Share on other sites

That looks awesome. I'll have to give it a go.

If it's working as expected in all/most IDEs I don't think I'll worry about building this into Tracy unless you guys can think of a reason why it would be a better fit there - it's nice to have less modules to install I guess, so maybe that's enough of a reason?

  • Like 3
Link to comment
Share on other sites

I have only discovered this today.

I have made a code template for netbeans. For the $page var, the template_name has to be filled in, then it should work with the template-stubs module.

Hope it helps.

/* ----------------------- ProcessWire API variables ------------------------ */
// <editor-fold>
/* @var $page tpl_${template_name} */
/* @var $pages Pages */
/* @var $modules Modules */
/* @var $user User */
/* @var $users Users */
/* @var $permissions Permissions */
/* @var $roles Roles */
/* @var $input WireInput */
/* @var $sanitizer Sanitizer */
/* @var $session Session */
/* @var $log WireLog */
/* @var $cache WireCache */
/* @var $datetime WireDateTime */
/* @var $files WireFileTools */
/* @var $mail WireMail */
/* @var $config Config */
/* @var $database WireDatabasePDO */
/* @var $fields Fields */
/* @var $templates Templates */
/* @var $languages Languages */
/* @var $wire ProcessWire */
/* @var $wire \ProCache */
// </editor-fold>

 

pw_nb_apivar_ct.png

  • Like 1
Link to comment
Share on other sites

We are getting off-topic here, but...

On 24/12/2017 at 3:22 AM, adrian said:

If it's working as expected in all/most IDEs I don't think I'll worry about building this into Tracy unless you guys can think of a reason why it would be a better fit there

If @mindplay.dk is not actively maintaining the module then I think it would be good to update it. It would be cool to have as an option in Tracy, or the module could be forked. I found that the module isn't working in PW3 where a namespace is declared at the top of template files. I had to modify the module code to add the namespace to stubs.php because the FileCompiler does not compile this file.

Also, I'm probably overlooking something but I can't see why the module needs to rebuild the stubs file after every Session::redirect and every ProcessPageView::finished.

 

On 24/12/2017 at 2:19 AM, adrian said:

That last comment suggests it's not working completely as expected.

I think that comment is due to a misunderstanding of what the module is for. The module only adds code completion to $page for field names in the current template - it isn't intended to provide code completion for all API variables (for that you have to add a DocBlock in every template file with tags for each API variable).

  • Like 4
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...