Home Download Buy Blog Forum Support

Php_beautifier plugin

Php_beautifier plugin

Postby barbuk on Wed Oct 26, 2011 8:09 am

Hi,
Just made a small plugin for sublime. It uses php_beautifier from pear channel http://pear.php.net/package/PHP_Beautifier/

You can grab it here https://github.com/SublimeText/PhpBeautifier or via package controle

Regards
Last edited by barbuk on Tue Jan 17, 2012 8:29 am, edited 1 time in total.
barbuk
 
Posts: 9
Joined: Wed Oct 26, 2011 8:03 am

Re: Php_beautifier plugin

Postby engin on Thu Oct 27, 2011 9:59 pm

thanks for this beautiful plugin. i love it.
engin
 
Posts: 1
Joined: Thu Oct 27, 2011 9:57 pm

Re: Php_beautifier plugin

Postby barbuk on Fri Oct 28, 2011 8:44 am

I just updated the plugin with options that add newlines in the code.

Code: Select all
-s4 -l \'ArrayNested() NewLines(before=switch:while:for:foreach:T_CLASS:return:break,after=T_COMMENT:protected:private)\'


I'm trying to add a newline just before comment block, but doesn't seem to work. More on that later
barbuk
 
Posts: 9
Joined: Wed Oct 26, 2011 8:03 am

Re: Php_beautifier plugin

Postby Arnold on Fri Jan 13, 2012 8:20 am

The command-line on a script of PHP Code Beautifier i downloaded recently appears to be a closed-source app and is not available for Mac OS X. That's embarrassing. Do not know what to do.
Arnold
 
Posts: 1
Joined: Fri Jan 13, 2012 8:12 am

Re: Php_beautifier plugin

Postby barbuk on Fri Jan 13, 2012 8:58 am

Hi Arnorld,

I'm aware that my plugin do not work well on macos. I'm in the process of refactoring the plugin to use 'subprocess' instead of 'commands', which will improve compatibility.
The php script used by the plugin is open source, under php licence. You can grab it here http://pear.php.net/package/PHP_Beautifier/.
barbuk
 
Posts: 9
Joined: Wed Oct 26, 2011 8:03 am

Re: Php_beautifier plugin

Postby barbuk on Tue Jan 17, 2012 8:28 am

Just push a new version of the plug-in. It now use the subprocess library, and call directly pear php_beautifier, so it should resolve the problem with MacOS (not tested yet, need feedback).
The plug-in currently format all current file content and I redirect stderr to a custom panel (so no more errors in place of the code \o/).

The next step is a decent config file with configurable php_beautifier path and filter. You can also edit the options directly in the python file. Default options are :

indent = "-s4" # 4 spaces
filters = "ArrayNested() NewLines(before=switch:while:for:foreach:T_CLASS:return:break) Pear(add-header=false)"
barbuk
 
Posts: 9
Joined: Wed Oct 26, 2011 8:03 am

Re: Php_beautifier plugin

Postby highend on Tue Jan 24, 2012 3:38 pm

Does this work with Sublime Text 2 (portable) under Windows (instead of linux / macos)?

If yes, can you provide the information how to install (or where to copy) the necessary php_beautifier components?

Tia,
Highend
highend
 
Posts: 93
Joined: Fri Jan 20, 2012 2:47 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: Yahoo [Bot] and 12 guests

cron