Coda PHP & Web Toolkit

  1. Download / Feedback •
  2. Help
  3. Coda Tips

AboutDownloadComments/Feedback

A Coda plugin aimed at PHP & Web development – not in active development.

Current version: 4.1 – Coda 1 and Coda 2

Features

  1. (Automatic) PHP syntax validation with jump to error and auto-save
  2. Clean up/reformat HTML, CSS, Javascript and PHP code (configurable)
  3. HTML, CSS and Javascript validation
  4. Minify Javascript and CSS
  5. Automatic check for updates
  6. It’s free (you can donate of course)

All features use the editor buffer (no need to save first) – Works with local and remote files – Written in Cocoa/ObjC.

General Preferences
Preferences for CSS
Preferences for Javascript
Validation with errors
Validation successful





Download

Download Coda PHP & Web Toolkit 4.1 »

Download Coda PHP & Web Toolkit 4.2 beta »

Sourcecode

https://bitbucket.org/mariofischer/php-web-toolkit/

Changelog »

Problems?

First have a look here » – if that doesn’t help, please write a comment below.

Enjoy using this plugin?

Great!
Just leave a comment or donate (via paypal) ».

For German users I can only recommend all-inkl.com (Partnerlink).

Planned Features

  • Apply some functions only to the selected area if desired (DONE – in the current beta)
  • Floating result windows/Growl-like notification/Use Growl (DONE – in the current beta)
  • Switch online validators more easy (DONE – in the current beta)
  • Rewrite curl methods in cocoa
  • Add configuration options for JSTidy
  • Automatically install updates
  • Use Coda 2 API for go to line (DONE – in the current beta)
  • Use Coda 2 API for automatic PHP validation before saving
  • Up next: Minify JS/CSS automatically on publishing
  • CSS minify: Check other minifier
  • Respect spaces per indent (in different cases)
  • PHP tidy: Preserve whitespaces, if possible
  • Minification: Upload .min.css or similar, if possible
  • Check new HTML5 tidy
  • Javascript execution directly via cocoa (improvement necessary)
  • Make PHP tidy more configurable (if possible)

795 Replies to “Coda PHP & Web Toolkit”

  1. Love this tool. Any chance of a tidy and validate for SASS? Would it be difficult to extend myself?

    1. I don’t have the time to continue development, but the source-code is available. In order to extend the tool you’d need to know Objective-C and how to use Xcode on OSX.

  2. Hi,

    Can the PHP validator be updated to support/understand PHP 7? For instance it reports error with spaceship operators () although those are perfectly legitimate. :)

  3. Hi again :-)

    Also support for minifying CSS variables would be deeply appreciated.

    Example:
    :root {
    –headerheight: 52px;
    –footerheight: 50px;
    –textblue: rgb(8, 145, 197);
    }

    Thanks. :) Also, this plugin just really made my day. It’s just what I’ve been looking for. :)

  4. PHP brace style “Always on new line” won’t work.
    I prefer this style:

    command
    {
    code …
    }

    but it still writes this:

    comand {
    code …
    }

  5. Is there a way (or better practice) for the html prettifier to leave something like this in peace? I meandered through the MAN of tidy but couldn’t find some way to exclude these.

    <input type="text" name="myname[]” value=”stuff” />
    or
    <a href="javascript:myfunky('’)”>great link

    thanks
    best
    manu

  6. Hi everybody,
    I’ve recognized that the css minifier doesn’t handle – @keyframes – right. It sets the keyframe name into double quotes. Is there a way to fix that?
    By the way thanks for the plugin, nice work!

    1. Hi –

      just had a look and according to google pagespeed there are no problems with minification… The CSS and JS files are loaded too early according to pagespeed.

        1. Okay I see – Google only complains about CSS files. I thought it was also about JS files, for these it would be reasonable to put them to the bottom.
          When it comes to CSS, I wouldn’t put them inline (except you use an asset framework which does this automatically). But in your case you could merge the CSS files into one file (if possible), this reduces the network requests per page.

          IMHO it’s important to balance page speed and maintainability, so I wouldn’t put too much effort in optimizing each PageSpeed complaint if this makes your page much harder to maintain.

  7. I was wondering if there were any settings that could better suite this plugging for email development and if not if I could request this for a future release.

    I develop a lot of emails at work. With my workflow, I generally code a HTML file, and a CSS file then use inliner.cm to convert my CSS to inline styling.

    However, I have noticed a few things with the HTML & CSS Tidy functions of this plugin that cause serious issues for Email Development.

    HTML:
    1.)The bgcolor html attribute gets a # added in front of it which causes Outlook to panic and ignore the background color declaration altogether.

    CSS:
    1.)6 digit hex colors get converted to 3 digits where possible. #FFFFFF becomes #FFF. Outlook does not support 3 digit hex colors and when it comes across one it panics and dumps all the inline styling defaulting to Times New Roman and the default fantasize and styling.
    2.)The “Margin” hack is required for Outlook.com. Outlook.com ignores margin declarations in css, but not when a capital “M” is used. CSS Tidy always converts this capital “M” to a lowercase “M” causing all margins to be ignored by Outlook.com

    I was wondering if there are currently any settings that could help me with these issues. And if not, if you could possibly add a preference for email development that takes those issues into account and does not make those changes while tiding to preserve compatibility with Outlook and Outlook.com.

    Thanks

  8. As of PHP 5.5+ you can access a class name statically by using the following:

    static::class

    PHP validation raises an error when validating this syntax. Is this the plugin itself or does it use the PHP engine on the local machine to perform validation?

    PHP 5.5.30 running on OS X.

    1. Just checked the advance settings tab and it is using a different PHP executable for validation. Have changed it and it is working fine now.

      Sorry for the bother.

  9. Tidy HTML causes Coda2 to freeze with rainbow spinner when ran on this quite simple HTML code: http://pastebin.com/cx8Ay7qJ

    To reproduce the bug. Launch Coda2, create a new HTML document, paste in the code from pastebin, select Plug-ins – PHP & Web Toolkit – HTML – Tidy HTML.

    Rainbow spinner runs forever, Application not responding, Force Quit is the only way out. OS X El Capitan 10.11.2, Coda 2.5.13 (17380), Coda PHP & Web Toolkit 4.2beta.

  10. Hi Mario,

    I have the bad habit of pressing alt+space sometimes when I’m typing fast, e.g. ” || {”
    (German keyboard)
    This creates a different kind of whitespace that prevents JSHint from working. It says JSHint returned nothing and I am to check that the encoding be UTF-8, which it is, though.
    There is actually the JSHint-option http://jshint.com/docs/options/#nonbsp for people like me, but it doesn’t seem to be supported by the version you’re shipping. (I tried the beta 4.2 as well)
    It would be great if I finally had a way to automatically find that special white-space as it often breaks my code.
    Also, when editing the custom options of JSHint, they don’t always get applied. JSHint picks up the old stuff and after a Coda restart the old stuff is there in the text field. It helps to click in another text field after modifying, e.g. on PHP tab.

    Maybe you find the time to look into it and thank you for your time

    Awesome plugin by the way!

    Cheers

  11. I really appreciate this plugin. Good work!

    One request:
    with “indent” it uses spaces. In Coda it is with tabs. Could you also offer indent with tabs?

    Thank you very much for putting so much effort in helping others

  12. I also had the message
    ““coda php returned nothing make sure files has no error try usign UTF-8 encoding” when i save my php files in Coda 2.5” on my Mac.

    I confirm it is because of /usr/bin/php

    But I don’t have MAMP, so I can’t use the solution provided by Paris Paraskeva

    When openning Mac Terminal, and doing /usr/bin/php I have the following message
    dyld: Library not loaded: /usr/lib/libnetsnmp.25.dylib Referenced from: /usr/bin/php Reason: image not found Trace/BPT trap: 5

    The solution is here : http://kaspars.net/blog/web-development/php-netsnmp-os-x

    Straight forward : type the following command in terminal mode :

    sudo ln -s /usr/lib/libnetsnmp.dylib /usr/lib/libnetsnmp.25.dylib

    And the message disappears

  13. Hi, from the last version of Coda (2.5.11), now I have this error on php code validation :

    PHP returned nothing
    Make sure the file has no errors, try using UTF-8 encoding.

    Any idea to help me ? Your plugin is so useful that i dont know what i can do if it is not working.

    Thanks, mike

    1. Hi –

      Please enable “debug mode” in the advanced section of the plugin preferences, open “Console”, start using Coda 2 and copy all the lines from the console which contain “Coda PHP Toolkit” and send them to me ( mario (at) chipwreck (dot) de)

  14. i started getting “coda php returned nothing make sure files has no error try usign UTF-8 encoding” when i save my php files in Coda 2.5.

    Anyone has an idea how i can troubleshoot this problem?

    I think this started after the latest Coda update.

      1. Hi Mario, your reply is much much appreciated! It turns out that my Macs php located under “/usr/bin/php” is broken so i simply changed in the preferences to use the mamp version instead which i am using to test my sites anyway “/Applications/MAMP/bin/php/php5.6.2/bin/php”!

  15. Hello,
    I am loving the Toolkit. Especially the minify on publish feature for Coda 2. Now that Google wants even html minified, is there any plans to implement this?

    Thanks,
    pbatts

  16. We use comments extensively in CSS files to help keep things organized, especially when multiple developers are maintaining the files.

    Is there a way to keep CSS minify from removing the comments?

    1. That wouldn’t really make sense IMHO… Minify is all about saving space/bandwidth – so superfluous whitespaces, unnecessary line breaks and comments are removed.
      In your case I’d recommend either using something like LessCSS or a minify tool that works “on the fly”, like Google Minify (code.google.com/p/minify/).

  17. Hi

    Does the “Minify JS/CSS automatically on publishing“ works? I want to use two css-files:

    style.css for editing and style.min.css for the website. I always want to edit the style.css but on save there should be the style.min.css created.

    greetings

    Gurkenglas

  18. some reason it won’t pass this php line
    $array[$key] = str_replace(’& nbsp;’,’ ‘,$value);

  19. When I use Tidy HTML it alway obliterates the HTML5 main element, removing it completely. How to make it not do that?

      1. Thanks for the reply, however, I AM using the “html5 compatible tidy” option. It still removes the html5 main element from the document when I employ HTML Tidy. Are you saying that you cannot replicate this? Am I the only one this is happening to?

      2. When I run a Validate HTML on my sample document, this is the result…

        line 231 column 1 – Error: is not recognized!
        line 231 column 1 – Warning: discarding unexpected
        line 313 column 1 – Warning: discarding unexpected
        Info: Document content looks like HTML5
        2 warnings, 1 error were found!

        This document has errors that must be fixed before
        using HTML Tidy to generate a tidied up version.

        About this fork of Tidy: http://w3c.github.com/tidy-html5/
        Bug reports and comments: https://github.com/w3c/tidy-html5/issues/
        Or send questions and comments to html-tidy@w3.org
        Latest HTML specification: http://dev.w3.org/html5/spec-author-view/
        HTML language reference: http://dev.w3.org/html5/markup/
        Validate your HTML5 documents: http://validator.w3.org/nu/
        Lobby your company to join the W3C: http://www.w3.org/Consortium

        1. hmm, the code for the main element is also removed from the pasted validation in my reply.

          Should read:

          line 231 column 1 – Error: (left caret)main(right caret) is not recognized!
          line 231 column 1 – Warning: discarding unexpected (left caret)main(right caret)
          line 313 column 1 – Warning: discarding unexpected (left caret)/main(right caret)
          Info: Document content looks like HTML5
          2 warnings, 1 error were found!

          This document has errors that must be fixed before
          using HTML Tidy to generate a tidied up version.

          1. I see. Use “custom configuration” for the HTML tidy and add “main” to the option “new-blocklevel-tags”:

            new-blocklevel-tags: article,aside,command,canvas,dialog,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,meter,main

  20. Hello there!

    Great plugin. A couple comments:

    PHP tidy behaves differently when selecting the command from the menu and when pressing the keyboard shortcut.

    If selected from a menu, tabs are not replaced by spaces (the way it should be). But when run with keyboard shortcut, tabs get replaced by spaces.

    The shortcut for tidying requires both hand and a forehead to hit all the keys. I’d like to be able to specify a shorter one. Even better, I’d like to auto-tidy at save time (an option to do that).

    1. Hi –

      php tidy should not behave differently in any way, because the keyboard shortcuts just trigger menu items…

      Auto-tidy seems (given the rest of the comments and my experience) not the best idea in many cases. Therefore that’s not a top priority now.

      About shortcuts: They can’t be easily changed given the Coda plugin setup, you have to put then in the code when creating the menu, therefore I’m afraid that won’t be possible for now.

      1. Oh dear. Now that I test, there is no difference between tidying with a keyboard shortcut vs selecting from the menu. Earlier I was surprised and tested many times with unexpected results. Now I am not able to reproduce this. I guess it was how the stars were aligned (I refuse to acknowledge any fault of my own, ever).

        Actually, I noticed that HTML-tidying replaces tabs with spaces. It may just be that the star alignment caused T and H to switch locations on my keyboard. Again, no fault of my own :-)

        Thanks for your reply and for the plugin.

  21. Thanks for this great plugin. If you’re having problems with HTML tidy striping out empty elements (such as “span” usage frequently found in bootstrap projects) then switch to HTML5 compatible tidy mode and add “drop-empty-elements: no” to the custom configuration. Seems to be working well for me. Look forward to further developments.

  22. I’m using your Coda PHP & Web Toolkit 4.2beta and, as a self-confessed novice, am just starting to familiarise myself with all of the the functionality. I have also encountered issues with Tidy removing empty tag elements such as or . As advised, I’ve used custom configuration and added span and strong to the comma-separated list of tags but this is not changing the behaviour of Tidy.

    However, I found through experimentation that if I select ‘Use HTML5 compatible Tidy’ in the Preferences and add ‘drop-empty-elements: no’ to my Custom Configuration, Tidy appears to start to behave.

    Is this method using the experimental fork of Tidy on GitHub that you mentioned? Have I gone about setting this up the right way?

    Thanks for a great plugin.

  23. Great Plugin,
    I just dont like the “success” floating windows, I wanted to edit the source code, but these part’s are in the compiled tidy files :(
    could you make these open source or/and an option to disable the success floating windows?

    thanks for sharing!

    1. Hi –

      I’ll make the source code available soon, as promised :) Takes still some time until I sort out some issues – which make the source code a bit more “readable”.

  24. Great plugin.. the only thing that drives me nuts (and it could just be that I’m using syntax the plugin doesn’t like).. Is the way it cleans up @font-face.. Every (second?) time I run it, it will shift quotes around and cause my CSS to fail until I un-shift them..

    So:
    @font-face {
    font-family:”coolveticaRegular”;
    src:url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.eot);
    src:url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.eot?#iefix) format(“embedded-opentype”),url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.woff) format(“woff”),url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.ttf) format(“truetype”),url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.svg#coolveticaregular) format(“svg”);
    font-weight:400;
    font-style:normal;
    }

    Becomes:
    @font-face {
    font-family:”coolveticaRegular”;
    src:url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.eot);
    src:url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.eot?#iefix) format(“embedded-opentype)”,”url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.woff”) format(“woff)”,”url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.ttf”) format(“truetype)”,”url(/images/Fonts/Coolvetica/coolvetica_rg-webfont.svg#coolveticaregular”) format(“svg”);
    font-weight:400;
    font-style:normal;
    }

  25. Heya,

    1st thing: love the plugin.

    2nd: it would be great if you could add an option, like you already have with paragraphs for other elements, or all elements. With the rise of font icons and the use of an empty “i” tag, its seems a good idea to have: drop-empty-tags as a configuration option.

    Whenever I am working with code that includes, say, font awesome icons, they are deleted as they are empty tags

      1. Totally, and i’ve done that, but that only keeps the “p” tags. I’m talking about using things like font awesome where you utilise empty “i” tags. For example…

        If you tidy this…

        Then the “p” tag remains but the “i” tag is removed. Thus if we could extent the custom options to add a “drop-empty-tags” in general rather than just “drop-empty-paras”

    1. Yes, that’s the normal behaviour of HTML tidy. But you can add custom tags in the plugin preferences, Tab HTML. Use custom configuration and then add a comma-separated list of tags, like this:

      new-blocklevel-tags: article,aside,command,i,what,ever

  26. I just installed the latest beta version of the plugin, and tested it on my HTML code. When I select to tidy the HTML, it strips out all of my custom tags. Is there any way to correct that?

    Here’s a code example before and after:

    [a href=”#” rel=”nofollow”][i][/i] Messaging[/a]

    After:
    [a href=”#” rel=”nofollow”]Messaging[/a]

  27. There seems to be a problem with Coda 2.5.1 and Your beta 4.2. I get this:

    Exception: TypeError: null is not an object (evaluating ‘JSHINT.errors[i].line’) JSHINTWRAP@/Users/asdf/Library/Application Support/Coda 2/Plug-ins/PhpPlugin.codaplugin/Contents/Resources/jshint-min.js:948:159 global code@/Users/asdf/Library/Application Support/Coda 2/Plug-ins/PhpPlugin.codaplugin/Contents/Resources/jshint-min.js:954:16

    I hope it will work eventually, I have found a lot of use for this excellent plugin, so thank you developer :-)

  28. OK, just installed 4.2 beta, I let you know fi I find anything :-)

    Btw. the html formatter always starts with this:

    isn’t it enough just write:

    ?

  29. Hello
    very nice plugin: is there a way to have inline check? Now we need to perform validation check: it would be great to be able to have php validation on the fly, like happens for IDE like Netbeans for example, when you forget a bracket , or a semicolon it always warns.

    Ciao

    Rudy

    1. I’d like this as well. As much flak as Dreamweaver gets, the realtime errors you get with php has really spoiled me. I went back to Coda and can’t believe it doesn’t support it.

Leave a Reply to Steve Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.