Debug php with Netbeans - Newbie source request - php

I'm using var_dump. Everywhere. It's a mess. And slow. I would like to lock a variable, right-click, choose test, and it will show me the output results on each period or my script, on a IDE window. -
1) Does something like this exist on Netbeans ?
2) Regardless about what could the "best" thing here, am wondering, if anyone could advice me some books/resources on the subject: "Debugging for newbies" ?
Update:
I realise that netbeans does have some possible integration. The hard part, however, is that of find newbie resources considering that integration. I mean, I need to understand how the debug tool work. True. But I also need to understand how debug work (in broad general terms sort of speak). :)
Thanks a lot in advance.

XDebug. For configuring it to work with Netbeans, see here: http://wiki.netbeans.org/HowToConfigureXDebug

1) The debug-solution for PHP is XDebug. It got all you need, like variable inspection eg.
2) Not long ago I was searching for that myself. So I know for pretty sure there is nothing like that. XDebug.org and Google will help you.

Related

PHP code explorer - showing classes and functions separately

I wonder if it's possible to view a PHP code source in a way that https://j11y.io/jquery/ shows a JQ code. Of course I mean reading code from a given file, not from websites code.
I'm not looking for programs like the PHPdocumentor.
Thank you in advance for any reasonable reply.
P.S. For perfectionists - I'm searching for a nice website or software (and I would prefer that option, so that I can be quite sure about the security), which will give me such a useful ability. I'm disturbed after using CTRL-F all the time ;)

Why is Aptana not colorizing regular expressions in PHP?

I've been a user of Textmate for many years, but I felt in love with Aptana a few days ago and I set it up to use Textmate colors. Mostly everything gets colorized the right way except for PHP, where every string looks the same.
In Textmate, if you make an string like $a="SELECT * from table", it detects you're writing an SQL query and colorizes it the right way; same works for $a="/regex/", but it's not happening on Aptana.
I know it's the PHP parser because Javascript works fine: you can type var a=/regex/ and you will get the regular expression in a different color.
I'd like to know if someone has been able to get into the parser's source code to edit it, and try to replace it with Textmate's one (which is available on the language bundle).
Thanks very much in advance :)
First make sure you have a php library addon for aptana installed, otherwise it will not recognize it and colorize it. Then reset your colorize options. I had the same problem at first, php not being colorized, then i installed a php library, sorry i cant access the name right now, if you are still interested tomorrow i will post it, and after a restart it recognized, colorized and suggested php code correctly. Sorry for the run on sentence.
Hope that works,
Oh and i should probably note this was with aptana 2.

A shared online code viewing tool with syntax highlighting?

I work with another developer on projects and sometimes we are chatting about them via IM. We can dropbox stuff back and forth, but it would be nice to have like an interactive version of pastie / google docs where we could see the same code and edit it together with syntax highlighting.
I know Cloud9IDE has something like this, but I am looking for a real-simple, realtime (if possible), shared textarea with PHP syntax highlighting. Does that exist?
UPDATE
This is what i was looking for: http://collabedit.com/
http://collabedit.com/
is probably what your looking for.
ShiftEdit will be helpful in this case.
This seems like a great solution:
http://phpanywhere.net/overview/
I haven't tried it, They should have real time collobration soon, but you can share and work on projects togheter with this.
I find github is pretty cool for collaboration between developpers. This is a very personnal opinion though, some of the friend developpers I have never got into using git so that is a show stopper with this platform. It may not be what you had in mind, though.
Don't know about the realtime-edit, but have look # https://join.me/ to share screens
Don't forget codepad, it allows your code to be tested online.
http://codepad.org/

Dreamweaver extension to beautify PHP/JavaScript/jQuery code

I'm looking so long for a Dreamweaver extension to auto beautify PHP / JavaScript / jQuery code. Currently Dreamweaver can beautify only HTML and CSS (Apply Source Formatting).
Any kind of help will be much appreciated.
Online solutions for validation and formatting JavaScript:
Validate JavaScript code:
http://www.javascriptlint.com/
Format JavaScript code:
http://jsbeautifier.org/
For the PHP side of things use https://github.com/fabpot/PHP-CS-Fixer
This short excerpt and more information is taken from the README.
Installation:
Download the php-cs-fixer.phar file and store it somewhere on your
computer.
Usage:
The fix command tries to fix as much coding standards problems as
possible on a given file or directory:
php php-cs-fixer.phar fix /path/to/dir
php php-cs-fixer.phar fix /path/to/file
I have found this great dreamweaver extenstion, just give it a try
Their Homepage: http://www.decodize.com/projects/
extension download page: http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=2107536
You can use PhpEdit, it's an extra debugger!
DW doesn't do debug, you find the error if and only if you run your code.
With PhpEdit, it is onTime.
Maybe try http://www.javascriptlint.com/
says it works on some IDEs, maybe DW is one of them.
Try googling, but use 'code format' not 'beautify'
I was wondering if you could elaborate on how to set this up. I see the CSS and Tag Libraries options under "Advanced Formatting", but I am stuck at that point as to how to get my PHP to start auto-indenting.
Or, if Dreamweaver has somehow fixed this problem, let me know! It seems like every other IDE has an auto-indent feature! Thanks :)
It's been a while since I have used DW, I use Aptana now and there is an option to format the code from one of the drop down menus. Just use something like "control a" (To select all your code), "control f" (To format your code). There might be another key combination but I think this will work if memory serves.
Maybe "esc control f"
I've not seen anything for Dreamweaver, but if you can copy ans paste the code, http://jsbeautifier.org/ can help you with making code look a good bit better. I've just tried it on some packed JavaScript and it worked out very well. You can also download the application and run it locally (it's only HTML and JavaScript), so you won't need an internet connection to get your code prettier.
Best way i found is to set the way Dreamweaver displays code yourself. Sure it takes some time to do but its worth it.
Here is how:
Dreamweaver: Edit > Preferences > Code Format
Then under Advanced Formatting you can pick CSS... or Tag Libraries...
You can make any of your code look as it should this way.
Like i said, will take some time but do it once and you can keep using it with all your future Dreamweaver versions.
In Dreamweaver CS6 no need any other extension or tools.
Just select your code and then Go to 'Commands' > 'Apply Source Formatting' or 'Apply Source Formatting to Selection'
Done. :)

is it possible to execute a portion of a php script to see what it does?

i am pulling apart a third party shopping cart and they have included a bunch of junk (as usual) aside from having to remove and bring back pieces of code to see what it does. is it possible to execute a few lines?
although setting up comments on codes i dont want to execute sounds good which i just thought of :p
but what other things exist that you guys know of?
thanks
This may be obvious but you can use a debugger (eclipse php or netbeans) and just put breakpoints after certain parts and "run to" that portion of the code. From there you can evaluate variables and potentially see output as it happens.
I don't know about codepad but I'm pretty sure Dreamweaver doesn't have a native PHP debugger built in. Take look at Xdebug or the Zend IDE.

Categories