Coda PHP Toolkit
Posted 8 months ago.
A Coda plugin aimed at PHP & Web development.
Features
- PHP syntax validation with
jump to error
- Use tidy to clean up/beautify HTML/CSS code (Configurable)
- HTML, CSS and Javascript Validation
- Use phptidy to clean up/beautify PHP code
- Strip PHP whitespace and comments
- Automatic check for updates
All features use the editor buffer (no need to save first), works with local and remote files.
Preferences can be set. Written in Cocoa/ObjC.
Planned Features
HTML Tidy configuration editable via preferencesJavascript Tools (First: JSLint, check in current beta)- Javascript: Some more tools (Minify etc.)
- More general approach to online validation
- Automatically install updates (if possible)
- Generalized filters (maybe?)
Screenshots
Download
Download Coda PHP & Web Toolkit 1.81 »

Like this?
Support on iusethis.com »…
..or leave a comment, spread the word, visit the ads, donate.
Also like to have an avatar image? Get one at gravatar.com (free) »

I’m using v1.8 beta, but I can’t get CSS Tidy to sort properties. I’ve even tried editing the csstidy.php file itself and updated the following line:
$this->settings['sort_properties'] = true;
Any suggestions?
csstidy.php is right – look at line 2658 and change two lines this way:
$css->set_cfg(‘sort_properties’, true);
..
$css->set_cfg(‘preserve_css’, false);
Question: What setting do you use? I will then add a new config setting in the next version.
Okay, this is now integrated in the 1.8 version, you can choose “Default, sorted” as a configuration option.
I had a quick question…I noticed that when I use the html tidy option it automatically changes my doctype to strict when I would like it to stay in transitional…is there any way to change that so that it doesn’t change my doctype declaration? thanks in advance for any advice…ps. I love this plugin minus this small issue.
Hi -
which config setting do you use for HTML tidy?
I am using the default configuration
This should work, I tried it with this doctype:
!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”
Otherwise send me the HTML-file, then I’ll have look.
Hi Mario
I contacted earlier just thought you might want the crash report error:
Link (dyld) error:
Symbol not found: _objc_setProperty
Referenced from: /Users/KT/Library/Application Support/Coda/Plug-ins/PhpPlugin.codaplugin/Contents/MacOS/PhpPlugin
Expected in: /usr/lib/libobjc.A.dylib
Thanks
Steve
Hi -
okay, some additional questions:
So Coda runs without the plugin normally? The plugin crash happens at startup? Which OSX-Version and which platform (ppc/intel ~ 32bit/64bit) do you use?
thx,
mario
Hi Mario
Coda runs okay until the plugin is installed then I delete the plugin file to get it working correctly I am using osx 10.4.11 Intel Core duo (not sure on 32-64bit??)
Do you want the crash report?
Thanks again
Steve
Hi -
yes, please – could you send me the logfile via email? mario (at) chipwreck (dot) de
OSX 10.4 is 32bit – maybe 10.4 is the problem, since I haven’t been able to test it on 10.4.
Hi again -
I’m afraid the code isn’t compatible with OS X 10.4 (according to Xcode) – so if you’ve got any chance to upgrade to 10.5/10.6 the plugin should run without problems.
I think i will upgrade – thanks for all your effort and I look forward to using the plugin after upgrade. If there is anything I can do for you just let me know
Thanks again
Steve
Hi
I am afraid the plugin I have downloaded crashes coda 1.6.10 when it is opened and continues to do so is there something I am missing?? Thankyou in advance
Steve
Hei!
I cannot save settings in coda after install your plugin. Anyone else with this problem?
Greetings.
Markus
Hi -
I assume you clicked “save” :) Could you open the Coda Preferences file located here:
YOUR_HOME_FOLDER/Library/Preferences/com.panic.Coda.plist
(You need a plist-editor, included for example in the Apple Developer Tools)
..and look if you find keys named “dechipwreckCssTidyConfig” or similar? (If you haven’t got an appropriate editor, drop me a mail)
Regards,
mario
There ist no “save”button on global coda-settings. And no, i doent find somethink like “dechipwreck…”.
Okay, misunderstood :) Coda preferences can’t be saved.
Will try to find out if it’s got something to do with the PHP Toolkit and if so, how to resolve. If someone else has the same problem – don’t hesitate to post a comment here.
UPDATE: Problem found, fixed in the upcoming version (the next days I suppose)
The about-windows says v0.96 – is this the latest version?
Eh no, the current version should be 1.62 .. v0.96 is much too old. Simply go to: “your user folder -> Library -> Application support -> Coda -> Plugins”, delete the old PhpToolkit plugin bundle, download the current one and double click it. This should work.
Absolutely awesome. Thanks for this!
This version appears to ignore the ‘Default Line Endings’ set in coda’s preferences?
Set to use windows
http://lulzwut.com/php/before.png
http://lulzwut.com/php/after.png
Hi -
okay, I’ll have a look. One question though: Was that any different in the previous versions?
[UPDATE Jan,25th] And again – no API function from Coda to read the current line endings.. But I’ll try to find a workaround of course..
mario
Huge improvement on version1.6
interface and the way it’s function.
Great work and Thanks
It works great on my G5, thanks for the PPC compatibility.
This is fantastic. Thanks so much!!
When running Tidy PHP I get the following error:
An application error has occurred.
This error will cause instability and it is recommended you quit and relaunch Coda.
(NSInvalidArgumentException) *** -(NSCFArray insertObject:atIndex:]: attempt to insert nil
Running php-toolkit 1.4 with Coda 1.6.7
Any suggestions?
Could you look at the Console output – there should be some more lines .. Or send me the file if possible?
[Update Nov, 26th] No reply until now – so I’ll assume it hasn’t happened again. Otherwise: Send a mail or comment here.
I got the same error “(NSInvalidArgumentException) *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil” here is what console saids.
12/11/09 7:33:04 PM Coda[21547] NSExceptionHandler has recorded the following exception:
NSInvalidArgumentException — *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil
Stack trace: 0x43319a 0x929ebe3b 0x96565dcb 0x96565e0a 0x95a3c660 0x9595a8d4 0x9595a7e4 0×14876743 0x14874ec5 0x95dcdb9b 0x14874d8b 0x95d8be8f 0x95d8bdcc 0x95d8bc52 0x95d8b2ab 0x95d8aafe 0x95d8a3b8 0x95d88af7 0x95d556a5 0x95cb2fe7 0x95c801d8 0×3512 0×3439 0×2
12/11/09 7:33:04 PM Coda[21547] NSExceptionHandler has recorded the following exception:
NSInvalidArgumentException — *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil
Stack trace: 0x43319a 0x929ebe3b 0x96565dcb 0x96565e0a 0x95a3c660 0x9595a8d4 0x9595a7e4 0×14876743 0x14874ec5 0x95dcdb9b 0x14874d8b 0x95d8be8f 0x95d8bdcc 0x95d8bc52 0x95d8b2ab 0x95d8aafe 0x95d8a3b8 0x95d88af7 0x95d556a5 0x95cb2fe7 0x95c801d8 0×3512 0×3439 0×2
I figured out the problem, if you dont save the document you get that error, once you save it and run it again it works fine.
Thx! Just updated the docs – I assume the document was new (=empty before you entered text and saved it) ?
The behaviour of the functions is a little bit inconsistent: php validation and php strip comment take the current editor buffer (regardless of what’s on the disk) – the other functions use the file on disk (so if you don’t save the file might be yet empty).
[UPDATE 1:] The beta version now handles this more graciously (beeps or tells you that you should save the file before).
[UPDATE 2:] One solution would be to save the file automatically (maybe not what everyone wants), another one to create a temp file with the buffer contents (nicer but creates lots of new error possibilites..:). I’ll have a look.
Thanks for the reply, (I got your notification). The document was new but not empty. I created a new document and pasted code from another document and did not save. I used the tidy functionality and that is when I got the error. Once I Saved the file it worked. Thanks for the update though.
Yes..that’s what I meant: The file on disk was still empty.
The beta version (see above) doesn’t have this problem anymore – you can automatically save the file before running CssTidy or PhpTidy. HtmlTidy works now with the current buffer contents (regardless of saving or not).
Awesome. Works a treat. Keep up the great work.
Thanks
Brent
[...] Coda PHP Toolkit | chipwreck [...]
[...] Coda PHP Toolkit [...]
This is great! Looking forward to trying this out! Many thanks for this :-)
[...] Coda PHP Toolkit [...]
This is great – seems to be exactly what Coda was missing for me… However: :)
When I try and validate the PHP I get an error: ‘Errors parsing -’ (with no further error details). If I click ‘Go to line’ nothing happens…
I’m on coda 1.6.5, PHP5.3.0 with Snow Leopard…
Thanks for your help!
Thanks.
Now…: “Go to Line” is a bit tricky if the erroneous line is out of focus.
“Errors parsing – ” is the “correct” answer from php, since the file is directly sent to php (without filename). What happens, if you open the Terminal and enter “php -l yourfile.php” ?
Hi Mario,
Sorry for the delay!
I’ve have tried what you suggest… with the following code error:
With the plugin, I get the ‘Errors parsing – ‘ message.
When I try in terminal I get:
PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in test.php on line 3
Errors parsing test.php
So I guess the plug-in is picking up the second error rather than the first?
if there’s anything else I can try, please let me know.
Best wishes,
Kevin
Yes, it seems the first (and much more interesting) error is either not visible or somehow discarded.
Could it be that the window is too small and hides the first error? It can be resized and reacts somewhat strange then, see the screenshot (click here)
So could you try to restart Coda, maximize the Coda window and drag the error-window at the bottom right handle?
thx,
mario
Just uploaded a new beta version- the window handling is fixed now.
Hey Mario,
No luck I’m afraid… I downloaded the beta and tried that, and can see that the error is now presented in a textarea, but it still just says ‘Errors parsing – ‘.
Let me know if I can do anything else to help identify the issue!
Best wishes,
Kevin
Okay, please download the current beta again, I put in some debugging code. Try validating some erroneous php-file and open the Console (viewing all messages). The error is being reported there like this “Coda PHP Plugin – PHP error: Parse error: syntax error, unexpected T_STRING in – on line 9 Errors parsing -” – what does the Console say?
And: what PHP version is reported in the “About…”-window of the plugin?
Thx for your help.
Hi Mario,
Console is showing:
25/10/2009 17:17:01 Coda[2757] Coda PHP Plugin – PHP error: Errors parsing -
Only other message I receive is about the PHP Plugin starting…
In About PHP Toolkit, local PHP Version is PHP 5.3.0 (cli).
Hope this helps!
Cheers,
Kev
Okay, finally found the error: If you use a php.ini-file (like /private/etc/php.ini) and set “display_errors” to off, this happens.
Hey, for some reason, with certain files, I’m unable to save them after using HTML tidy. Permissions are correct, so I’m not sure what’s going on. Any ideas?
[Updated Nov, 12th] Had seemingly nothing to do with the plugin – a filesystem problem.
Very awesome, thanks a lot!