Jump to content
pwuser1

Recommended PHP Editor or IDE?

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

Share this post


Link to post
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

Share this post


Link to post
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 7

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

@Kiwi thanks for you helpful comments, full debugging matters so I think VSCode is better that way vs Atom, but check out Codelobster it's a PHP specialist.

Share this post


Link to post
Share on other sites

FWIW it's Atom for me. Has got much better recently and seems much less of a resource hog than Netbeans et al. Also has a uiKit autocomplete plugin.

Share this post


Link to post
Share on other sites
58 minutes ago, adrian said:

Nice find!

That last comment suggests it's not working completely as expected. Have you tested it? Any issues?

It works with Netbeans here. I can select the fieldnames from within the IDE.

 

pw_nb_apivar.png

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
On 12/23/2017 at 3:22 PM, adrian said:

it's nice to have less modules to install I guess, so maybe that's enough of a reason?

+1 :) Plus @mindplay.dk last visited the forums in Oct 2015 and seems to be working on non-PW related projects.

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...