Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: jonesH on December 16, 2015, 11:31:18 AM

Title: PHP Helper Framework
Post by: jonesH on December 16, 2015, 11:31:18 AM
Some programming languages that I am more or less familiar with can use tools that help the programmer with execution flow, debugging, breakpoints, stuff related to variables and so on. I tried using Chrome Developer Tools but it's not what I wanted (good for lots of other duties, though). My usual working environment is localhost on Windows 7 Pro with WAMPStack or OSX Snow Leopard with MAMPStack.

For instance, I would like to read the value that $context takes, to see which functions are loaded and when, whether conditions are met or not etc. I expect this would help me better understand the workings of SMF.

Is anyone aware of some such tools? Perhaps a PHP helper? It need not be too complicated, as my PHP working knowledge is not that deep... Of course I can search for one on the web and try until I find something, but I would imagine folks here have already tried some and can tell about.Regards.
Title: Re: PHP Helper Framework
Post by: Kindred on December 16, 2015, 11:32:48 AM
As far as I know, no one has done this.
Title: Re: PHP Helper Framework
Post by: Bigguy on December 16, 2015, 12:51:55 PM
Are you referring to a php editor ?? If so Php Designer is a good tool to use. If your talking about browser add-ons then firebug and web developer for FF is great to use as well.
Title: Re: PHP Helper Framework
Post by: margarett on December 16, 2015, 05:17:25 PM
AFAIR it's a bit more complicated than that. You can use integrated developer tools like Zend *if* the target platform is/was built supported on said platforms. SMF isn't. SMF was built from scratch and its roots comes from before that.
Want to know what $context carries at some point? print_r/var_dump are your friends ;)

Browser developer tools cannot ever know what PHP is doing as they only see what the server sends them and that's one (or two) step after PHP was executed.
Title: Re: PHP Helper Framework
Post by: Matthew K. on December 16, 2015, 06:51:13 PM
You should be able to set breakpoints in any modern IDE such as PHPStorm (Mac, Windows, Linux) or PHP Designer (Windows)

Honestly though, even a lot of times at work, nothing beats: echo '<pre>', var_dump($context), '</pre>'; die();
Title: Re: PHP Helper Framework
Post by: margarett on December 16, 2015, 07:48:02 PM
Quote from: Labradoodle-360 on December 16, 2015, 06:51:13 PM
(...) nothing beats: echo '<pre>', var_dump($context), '</pre>'; die();
^^ What he said! (well, the die(); isn't strictly necessary :P )
Title: Re: PHP Helper Framework
Post by: jonesH on December 17, 2015, 01:01:05 PM
I get the picture. Back in the day, I used to do lots of Microsoft VB work and there were cool built-in helpers. Since PHP comes without, I was hoping to find a similar add-on for PHP.


Anyway, your replies give me direction. In general, I am little inclined to pay for software that I might in the end not even keep using, even aside from the required learning curve. I toyed around with var_dump and boy does it rock!


I also consider moving away from Safari/Chrome to FireFox and see if it offers better/more dev tools.


Thank you all. I will mark this as solved, but anyone is welcome to add to it.
Title: Re: PHP Helper Framework
Post by: Joshua Dickerson on December 25, 2015, 12:40:28 PM
Netbeans is free.
Title: Re: PHP Helper Framework
Post by: nend on January 10, 2016, 11:24:58 PM
Quote from: Labradoodle-360 on December 16, 2015, 06:51:13 PM
Honestly though, even a lot of times at work, nothing beats: echo '<pre>', var_dump($context), '</pre>'; die();
if (isset($_REQUEST['sidebug']) && $context['user']['is_admin']) {
$tmp = $GLOBALS;
$tmp['_SERVER'] = null;
$tmp['_ENV'] = null;
$tmp['db_passwd'] = null;
$tmp['db_user'] = null;
$tmp['db_name'] = null;
$tmp['db_name'] = null;
$tmp['db_prefix'] = null;
$tmp['smcFunc'] = null;
print_r($tmp);
die();
}

Check  :D