Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP beautification not working in Windows #288

Closed
guillempascual opened this issue Apr 24, 2015 · 19 comments
Closed

PHP beautification not working in Windows #288

guillempascual opened this issue Apr 24, 2015 · 19 comments

Comments

@guillempascual
Copy link

When beautifying from inside Atom nothing happens: nor fixing nor any error message.
If I run php C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar fix example.php it works perfectly.
I have uninstalled and installed back Atom-beautify.
This is the debug trace:

Atom Beautify - Debugging information

The following debugging information was generated by Atom Beautify on Fri Apr 24 2015 12:16:27 GMT+0200 (Hora de verano romance).


Platform: win32

Versions

Atom Version: 0.192.0

Atom Beautify Version: 0.24.1

Original file to be beautified

Original File Path: C:\tools\example.php

Original File Grammar: PHP

Original File Contents:

<html>

Hello
</html>
<?php

$listOfColors = array('green','yellow','red');

                foreach ($listOfColors as $color) {
            echo $color;
        }
?>

Beautification options

Editor Options:
Options from Atom Editor settings

{
    "indent_size": 4,
    "indent_char": " ",
    "indent_with_tabs": false
}

Config Options:
Options from Atom Beautify package settings

{
    "php": {
        "cs_fixer_path": "C:\\php-5.5.3-Win32-VC11-x64\\php-cs-fixer.phar",
        "fixers": "",
        "level": ""
    },
    "js": {
        "indent_size": 4,
        "indent_char": " ",
        "indent_level": 0,
        "indent_with_tabs": false,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "space_in_paren": false,
        "jslint_happy": false,
        "space_after_anon_function": false,
        "brace_style": "collapse",
        "break_chained_methods": false,
        "keep_array_indentation": false,
        "keep_function_indentation": false,
        "space_before_conditional": true,
        "eval_code": false,
        "unescape_strings": false,
        "wrap_line_length": 0,
        "end_with_newline": false
    },
    "css": {
        "indent_size": 4,
        "indent_char": " ",
        "selector_separator_newline": false,
        "newline_between_rules": false,
        "preserve_newlines": false
    },
    "html": {
        "htmlbeautifier_path": "",
        "indent_inner_html": false,
        "indent_size": 4,
        "indent_char": " ",
        "brace_style": "collapse",
        "indent_scripts": "normal",
        "wrap_line_length": 250,
        "wrap_attributes": "auto",
        "wrap_attributes_indent_size": 4,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "unformatted": [
            "a",
            "sub",
            "sup",
            "b",
            "i",
            "u"
        ],
        "end_with_newline": false
    },
    "sql": {
        "indent_size": 4,
        "keywords": "upper",
        "identifiers": "lower",
        "sqlformat_path": ""
    },
    "markdown": {
        "pandoc_path": "",
        "yaml_front_matter": true
    },
    "perl": {
        "perltidy_path": "perltidy",
        "perltidy_profile": ""
    },
    "python": {
        "autopep8_path": "",
        "max_line_length": 79,
        "indent_size": 4,
        "ignore": [
            "E24"
        ]
    },
    "ruby": {
        "rbeautify_path": ""
    },
    "c": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cpp": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "objectivec": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cs": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "d": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "java": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "pawn": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "vala": {
        "uncrustifyPath": "",
        "configPath": ""
    }
}

Home Options:
Options from C:\home\.jsbeautifyrc

{}

EditorConfig Options:
Options from EditorConfig file

{}

Project Options:
Options from .jsbeautifyrc files starting from directory C:\tools and going up to root

[
    {}
]

Logs

Error logs: Not yet supported

@Glavin001 Glavin001 changed the title atom-beautify not working in Windows PHP beautification not working in Windows Apr 24, 2015
@Glavin001 Glavin001 added the bug label Apr 24, 2015
@Glavin001 Glavin001 self-assigned this Apr 24, 2015
@Glavin001 Glavin001 added this to the v1.0.0 milestone Apr 24, 2015
@Glavin001 Glavin001 modified the milestones: v1.1.0, v1.0.0, v0.26.0, v0.27.0 May 1, 2015
@Glavin001
Copy link
Owner

Try updating to v0.26.4 and run the Help Debug Editor again. It now supports error logs (see #296 ) which should help debugging this.

@Glavin001
Copy link
Owner

I can reopen this issue if it still exists and with additional information.

v0.25.0 has since been released (as well as v0.26.0 and more) and has very drastic implementation changes that should clean issues like this up.

@Glavin001 Glavin001 modified the milestones: v0.25.0, v0.27.0, v0.26.0 May 5, 2015
@guillempascual
Copy link
Author

Still not working ok.
Now it show a red screen with the error:
"spawn php-cs-fixer ENOENT
Hide Stack Trace
Error: spawn php-cs-fixer ENOENT
at exports._errnoException (util.js:734:11)
at Process.ChildProcess._handle.onexit (child_process.js:1035:32)
at child_process.js:1127:20
at process._tickCallback (node.js:357:13)"

Atom Beautify - Debugging information

The following debugging information was generated by Atom Beautify on Thu May 07 2015 16:45:34 GMT+0200 (Hora de verano romance).


Platform: win32

Versions

Atom Version: 0.196.0

Atom Beautify Version: 0.27.0

Original file to be beautified

Original File Path: C:\tools\example.php

Original File Grammar: PHP

Original File Contents:

<html>

Hello

</html>
<?php
    $listOfColors = array('green', 'yellow', 'red');

            foreach ($listOfColors as $color) {
                        echo $color;
    } ?>

Beautification options

Editor Options:
Options from Atom Editor settings

{
    "indent_size": 4,
    "indent_char": " ",
    "indent_with_tabs": false
}

Config Options:
Options from Atom Beautify package settings

{
    "php": {
        "cs_fixer_path": "C:\\php-5.5.3-Win32-VC11-x64\\php-cs-fixer.phar",
        "fixers": "",
        "level": ""
    },
    "cs": {
        "configPath": ""
    },
    "c": {
        "configPath": ""
    },
    "cpp": {
        "configPath": ""
    },
    "css": {
        "indent_size": 4,
        "indent_char": " ",
        "selector_separator_newline": false,
        "newline_between_rules": false,
        "preserve_newlines": false
    },
    "d": {
        "configPath": ""
    },
    "html": {
        "indent_inner_html": false,
        "indent_size": 4,
        "indent_char": " ",
        "brace_style": "collapse",
        "indent_scripts": "normal",
        "wrap_line_length": 250,
        "wrap_attributes": "auto",
        "wrap_attributes_indent_size": 4,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "unformatted": [
            "a",
            "sub",
            "sup",
            "b",
            "i",
            "u"
        ],
        "end_with_newline": false
    },
    "java": {
        "configPath": ""
    },
    "js": {
        "indent_size": 4,
        "indent_char": " ",
        "indent_level": 0,
        "indent_with_tabs": false,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "space_in_paren": false,
        "jslint_happy": false,
        "space_after_anon_function": false,
        "brace_style": "collapse",
        "break_chained_methods": false,
        "keep_array_indentation": false,
        "keep_function_indentation": false,
        "space_before_conditional": true,
        "eval_code": false,
        "unescape_strings": false,
        "wrap_line_length": 0,
        "end_with_newline": false
    },
    "objectivec": {
        "configPath": ""
    },
    "pawn": {
        "configPath": ""
    },
    "perl": {
        "perltidy_profile": ""
    },
    "python": {
        "max_line_length": 79,
        "indent_size": 4,
        "ignore": [
            "E24"
        ]
    },
    "sql": {
        "indent_size": 4,
        "keywords": "upper",
        "identifiers": "lower"
    },
    "vala": {
        "configPath": ""
    }
}

Home Options:
Options from C:\home\.jsbeautifyrc

{}

EditorConfig Options:
Options from EditorConfig file

{}

Project Options:
Options from .jsbeautifyrc files starting from directory C:\tools and going up to root

[
    {}
]

Results

Beautified File Contents:

Error: spawn php-cs-fixer ENOENT

Logs:

2015-05-07T14:45:34.109Z - info: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] beautify <html>

Hello

</html>
<?php
    $listOfColors = array('green', 'yellow', 'red');

            foreach ($listOfColors as $color) {
                        echo $color;
    } ?>
 [ { indent_size: 4, indent_char: ' ', indent_with_tabs: false },
  { php: 
     { cs_fixer_path: 'C:\\php-5.5.3-Win32-VC11-x64\\php-cs-fixer.phar',
       fixers: '',
       level: '' },
    cs: { configPath: '' },
    c: { configPath: '' },
    cpp: { configPath: '' },
    css: 
     { indent_size: 4,
       indent_char: ' ',
       selector_separator_newline: false,
       newline_between_rules: false,
       preserve_newlines: false },
    d: { configPath: '' },
    html: 
     { indent_inner_html: false,
       indent_size: 4,
       indent_char: ' ',
       brace_style: 'collapse',
       indent_scripts: 'normal',
       wrap_line_length: 250,
       wrap_attributes: 'auto',
       wrap_attributes_indent_size: 4,
       preserve_newlines: true,
       max_preserve_newlines: 10,
       unformatted: [Object],
       end_with_newline: false },
    java: { configPath: '' },
    js: 
     { indent_size: 4,
       indent_char: ' ',
       indent_level: 0,
       indent_with_tabs: false,
       preserve_newlines: true,
       max_preserve_newlines: 10,
       space_in_paren: false,
       jslint_happy: false,
       space_after_anon_function: false,
       brace_style: 'collapse',
       break_chained_methods: false,
       keep_array_indentation: false,
       keep_function_indentation: false,
       space_before_conditional: true,
       eval_code: false,
       unescape_strings: false,
       wrap_line_length: 0,
       end_with_newline: false },
    objectivec: { configPath: '' },
    pawn: { configPath: '' },
    perl: { perltidy_profile: '' },
    python: { max_line_length: 79, indent_size: 4, ignore: [Object] },
    sql: { indent_size: 4, keywords: 'upper', identifiers: 'lower' },
    vala: { configPath: '' } },
  {},
  {},
  {} ] PHP C:\tools\example.php
2015-05-07T14:45:34.110Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] PHP name=PHP, namespace=php, grammars=[PHP], extensions=[php], type=string, default=, description=Add fixer(s). i.e. linefeed,-short_tag,indentation (Supported by PHP-CS-Fixer), title=PHP - Fixers, beautifiers=[PHP-CS-Fixer], type=string, default=, description=By default, all PSR-2 fixers and some additional ones are run. (Supported by PHP-CS-Fixer), title=PHP - Level, beautifiers=[PHP-CS-Fixer], beautifiers=[PHP-CS-Fixer]
2015-05-07T14:45:34.110Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] beautifier PHP-CS-Fixer silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, languages=[PHP]
2015-05-07T14:45:34.134Z - debug: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] php-cs-fixer indent_size=4, indent_char= , indent_with_tabs=false, cs_fixer_path=C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar, fixers=, level=
2015-05-07T14:45:34.145Z - debug: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] tempFile temp null path=C:\Users\Guillem\AppData\Local\Temp\temp11547-6344-1puzbxn, fd=0
2015-05-07T14:45:34.148Z - debug: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn php-cs-fixer 0=fix, 1=C:\Users\Guillem\AppData\Local\Temp\temp11547-6344-1puzbxn
2015-05-07T14:45:34.154Z - debug: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] error Error: spawn php-cs-fixer ENOENT
  at exports._errnoException (util.js:734:11)
  at Process.ChildProcess._handle.onexit (child_process.js:1035:32)
  at child_process.js:1127:20
  at process._tickCallback (node.js:357:13)


@CyberPunkCodes
Copy link

I am also having this issue. I have NEVER been able to beautify anything with Atom..

@Glavin001
Copy link
Owner

When Atom is opened from a Terminal, it properly gets the environment variables in process.env for Node.js, this includes the PATH environment variable. However, when opening Atom from file browser (double click on application and open it, etc) it does not properly detect process.env correct. This is a common and well known problem with both Node.js and consequently Atom.

The error you are receiving indicates that PHP-CS-Fixer cannot be found, and therefore cannot be executed. Atom Beautify normally detects the proper environment variables for Operating Systems such as Linux (Ubuntu) and Mac; Windows is a very special case, as it's shell doesn't handle this well.
See https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/beautifier.coffee#L91-L133 for applicable source code. There is a package in development to standardize this: https://github.com/ioquatix/shell-environment
Since detecting the path for Windows does not work (falls back to process.env, see https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/beautifier.coffee#L100-L105 ), we must change the PATH environment variable detected in Node.js (Atom) manually (see option 2 below).

I notice you have set cs_fixer_path to C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar. With the updates to Atom Beautify in v0.25.0 ( see #282 ) the environment variables have been automatically detected (as described above), in most Operating Systems, all except for Windows. This means that users no longer are required to configure their beautifier CLI paths such as cs_fixer_path, as these are automatically detected.

Let's discuss some Windows workarounds. I do not use Windows for development so you'll have to test these and let me know if they work.

Option 1) Run Atom from Terminal
This should properly pass the environment variables to Atom, thus process.env.PATH and others will be correct and Node.js should be able to find php-cs-fixer.phar properly.
Could you both try to open Atom from shell? For instance, run atom . from your project directory.

Option 2) Manually set process.env.PATH to the correct PATH environment variable in Atom
As a workaround for Windows users, and for other Atom packages, we can manually set the PATH environment variable stored in process.env.PATH.

  • Get your PATH in Windows terminal. See http://geekswithblogs.net/AskPaula/archive/2008/12/18/128035.aspx for example. Run echo %path%
  • Atom -> Open Your Init Script
  • In your Init Script, let's set process.env.PATH to the value you've retrieved for your shell's environment variable, PATH. For instance, add the line process.env.PATH = "C:\php-5.5.3-Win32-VC11-x64\";. This will replace your PATH with C:\php-5.5.3-Win32-VC11-x64\ such that when Node.js attempts to look for php-cs-fixer it will look in that directory.

Let me know how this options work for you.

These issues are related to Windows and environment variables in Node.js. These are not Atom Beautify specific, and more so related to Atom and Node.js. There are many other packages also having these issues. Atom Beautify attempts to resolve this issue automatically, however it works on other Operating Systems and not Windows.

I hope that now you have an understanding of why this is happening and therefore can do some debugging on your own and contribute your knowledge and experiences back in this Issue for other Windows users.

Thank you.

@Glavin001 Glavin001 modified the milestones: v0.28.0, v0.26.0 May 18, 2015
@CyberPunkCodes
Copy link

Opening it in terminal has no effect for me. I am receiving the exact same error as OP. I agree, it probably indicates Atom can't find php-cs-fixer. I can confirm, than I can run it from cmd to fix a file, using "php-cs-fixer fix filename.php --level=psr2" and it works just fine.

In windows, under my Environment Variables, I have composer in 2 spots. One for my user profile, and the other for the system. Variables for me: C:\Users\Wade\AppData\Roaming\Composer\vendor\bin and under the system variables: C:\ProgramData\ComposerSetup\bin. Since php-cs-fixer was not in the later, I copied it from one bin to another, just in case. This didn't help.

In atom, I edited my init:
process.env.PATH = "C:/Users/Wade/AppData/Roaming/Composer/vendor/bin"

I also tried the path to PHP, didn't help either. Between each attempt, I closed Atom and re-opened it. It seems like no combination of the paths helps.

While I hope to get a MacBook in the near future, It should work in Windows. Even if we have to click "Browse" and select the folder php-cs-fixer is in, it should be looked at.

@Glavin001
Copy link
Owner

It should work in Windows. Even if we have to click "Browse" and select the folder php-cs-fixer is in, it should be looked at.

I agree, however if we cannot even get it to work by manually changing the PATH then we cannot yet develop a nicer solution, such as browsing for the path and other options. Once we have a reproducible way to handle Windows then we can improve its usage.

@guillempascual let me know if you have any luck.

@guillempascual
Copy link
Author

Hi @Glavin001,

No luck.

I've tried Option 1), no use, same fault.
As to Option 2), I've manually edited my ini so it reads process.env.PATH = "C:/php-5.5.3-Win32-VC11-x64/" and the result is the same, the ENOENT problem. But in C:/php-5.5.3-Win32-VC11-x64 it does exist the file php-cs-fixer.phar.

I'm really willing to help with this issue so me and other Windows users can make use of the beautifier.
But I just need some info:
-1. This module was working prior to 0.25. So the only change from 0.25 on was the detection of the env variables? If yes, I'll have to find out why setting manually the env var doesn't fix things.
-2. With Windows the main repetitive issue has been always that the command "php" has to be put before "php-cs-fixer.phar" for it to be executed. (CLI) Could it not be that the case now?
-3 I'll dwell in the code, but first I should learn some concepts on Nodejs modules and coffescript. I've had located the code calling php-cs-fixer at src/php-cs-fixer.coffee. Any hints please? I cannot locate the call the PHP CLI.

Thank you.

That's the trace.

Atom Beautify - Debugging information

The following debugging information was generated by Atom Beautify on Wed May 20 2015 09:52:32 GMT+0200 (Hora de verano romance).


Platform: win32

Versions

Atom Version: 0.199.0

Atom Beautify Version: 0.27.2

Original file to be beautified

Original File Path: C:\htdocs\monitor\application\views\emails\pedido.php

Original File Grammar: PHP

Original File Contents:

<br/>
<?=$mensaje?>
<br/>
<br/>
<br/>
<table>
    <tr>
        <td style="font-weight:bold;" >
            Centro
        </td>
        <td>
            <?=(empty($direccion['centro']) ? "Tienda propia" :  $direccion['centro']) ?>
        </td>
    </tr>
    <tr>
        <td style="font-weight:bold;vertical-align:top">
            Dirección
        </td>
        <td>
                    <table>
                <tr>
                    <td>
                        <?=$direccion['domicilio']?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?=$direccion['codigoPostal']?>&nbsp;&nbsp;<?=$direccion['poblacion']?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?=$direccion['provincia']?>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<br/>
<hr/>
    <table>
        <tr>
            <td style="font-weight:bold;vertical-align:top">
                Tienda
            </td>
            <td>
                <?=$pedido['nombreTienda']?><br/><?=$pedido['nombreDelegacion']?>
        <tr>
            <td style="font-weight:bold;vertical-align:top">
                Contacto
            </td>
            <td>
                <table>
                    <tr>
                        <td>
                            <?=$pedido['personaContacto']?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?=$pedido['movilCliente']?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <a href="<?=$pedido['emailCliente']?>" target="_blank"><?=$pedido['emailCliente']?></a>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <br/>
    <table>
        <thead>
            <tr>
                <th style="text-align: left">Modelo</th>
                <th style="text-align: left">N.Serie</th>
                <th style="text-align: left">Product Number</th>
                <th style="text-align: left">Descripción</th>
                <th style="text-align: left">Cantidad</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($pedido['lineas_pedido'] as $linea_pedido): ?>
            <tr>
                <td style="width:100px"><?=$linea_pedido['fm11500DescArtic']?></td>
                <td style="width:100px"><?=$linea_pedido['fg20700NumSerie']?></td>
                <td style="width:100px"><?=$linea_pedido['ProductNumber']?></td>
                <td style="width:100px"><?=$linea_pedido['MarkerColor']?></td>
                <td style="width:100px">1 ud.</td>
            </tr>
        <?php endforeach ?>
        </tbody>
    </table>

Beautification options

Editor Options:
Options from Atom Editor settings

{
    "_default": {
        "indent_size": 4,
        "indent_char": " ",
        "indent_with_tabs": false
    }
}

Config Options:
Options from Atom Beautify package settings

{
    "php": {
        "cs_fixer_path": "C:\\php-5.5.3-Win32-VC11-x64\\php-cs-fixer.phar",
        "fixers": "",
        "level": ""
    },
    "cs": {
        "configPath": ""
    },
    "c": {
        "configPath": ""
    },
    "cpp": {
        "configPath": ""
    },
    "css": {
        "indent_size": 4,
        "indent_char": " ",
        "selector_separator_newline": false,
        "newline_between_rules": false,
        "preserve_newlines": false
    },
    "d": {
        "configPath": ""
    },
    "html": {
        "indent_inner_html": false,
        "indent_size": 4,
        "indent_char": " ",
        "brace_style": "collapse",
        "indent_scripts": "normal",
        "wrap_line_length": 250,
        "wrap_attributes": "auto",
        "wrap_attributes_indent_size": 4,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "unformatted": [
            "a",
            "sub",
            "sup",
            "b",
            "i",
            "u"
        ],
        "end_with_newline": false
    },
    "java": {
        "configPath": ""
    },
    "js": {
        "indent_size": 4,
        "indent_char": " ",
        "indent_level": 0,
        "indent_with_tabs": false,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "space_in_paren": false,
        "jslint_happy": false,
        "space_after_anon_function": false,
        "brace_style": "collapse",
        "break_chained_methods": false,
        "keep_array_indentation": false,
        "keep_function_indentation": false,
        "space_before_conditional": true,
        "eval_code": false,
        "unescape_strings": false,
        "wrap_line_length": 0,
        "end_with_newline": false
    },
    "objectivec": {
        "configPath": ""
    },
    "pawn": {
        "configPath": ""
    },
    "perl": {
        "perltidy_profile": ""
    },
    "python": {
        "max_line_length": 79,
        "indent_size": 4,
        "ignore": [
            "E24"
        ]
    },
    "sql": {
        "indent_size": 4,
        "keywords": "upper",
        "identifiers": "lower"
    },
    "vala": {
        "configPath": ""
    }
}

Home Options:
Options from C:\home\.jsbeautifyrc

{
    "_default": {}
}

EditorConfig Options:
Options from EditorConfig file

{
    "isFulfilled": false,
    "isRejected": false
}

Project Options:
Options from .jsbeautifyrc files starting from directory C:\htdocs\monitor\application\views\emails and going up to root

[
    {
        "_default": {}
    },
    {
        "_default": {}
    },
    {
        "_default": {}
    },
    {
        "_default": {}
    },
    {
        "_default": {}
    }
]

Results

Beautified File Contents:

Error: spawn php-cs-fixer ENOENT

Logs:

2015-05-20T07:52:32.617Z - info: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] beautify <br/>
<?=$mensaje?>
<br/>
<br/>
<br/>
<table>
    <tr>
        <td style="font-weight:bold;" >
            Centro
        </td>
        <td>
            <?=(empty($direccion['centro']) ? "Tienda propia" :  $direccion['centro']) ?>
        </td>
    </tr>
    <tr>
        <td style="font-weight:bold;vertical-align:top">
            Dirección
        </td>
        <td>
                    <table>
                <tr>
                    <td>
                        <?=$direccion['domicilio']?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?=$direccion['codigoPostal']?>&nbsp;&nbsp;<?=$direccion['poblacion']?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?=$direccion['provincia']?>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<br/>
<hr/>
    <table>
        <tr>
            <td style="font-weight:bold;vertical-align:top">
                Tienda
            </td>
            <td>
                <?=$pedido['nombreTienda']?><br/><?=$pedido['nombreDelegacion']?>
        <tr>
            <td style="font-weight:bold;vertical-align:top">
                Contacto
            </td>
            <td>
                <table>
                    <tr>
                        <td>
                            <?=$pedido['personaContacto']?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <?=$pedido['movilCliente']?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <a href="<?=$pedido['emailCliente']?>" target="_blank"><?=$pedido['emailCliente']?></a>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <br/>
    <table>
        <thead>
            <tr>
                <th style="text-align: left">Modelo</th>
                <th style="text-align: left">N.Serie</th>
                <th style="text-align: left">Product Number</th>
                <th style="text-align: left">Descripción</th>
                <th style="text-align: left">Cantidad</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($pedido['lineas_pedido'] as $linea_pedido): ?>
            <tr>
                <td style="width:100px"><?=$linea_pedido['fm11500DescArtic']?></td>
                <td style="width:100px"><?=$linea_pedido['fg20700NumSerie']?></td>
                <td style="width:100px"><?=$linea_pedido['ProductNumber']?></td>
                <td style="width:100px"><?=$linea_pedido['MarkerColor']?></td>
                <td style="width:100px">1 ud.</td>
            </tr>
        <?php endforeach ?>
        </tbody>
    </table>
 [ { _default: { indent_size: 4, indent_char: ' ', indent_with_tabs: false } },
  { php: 
     { cs_fixer_path: 'C:\\php-5.5.3-Win32-VC11-x64\\php-cs-fixer.phar',
       fixers: '',
       level: '' },
    cs: { configPath: '' },
    c: { configPath: '' },
    cpp: { configPath: '' },
    css: 
     { indent_size: 4,
       indent_char: ' ',
       selector_separator_newline: false,
       newline_between_rules: false,
       preserve_newlines: false },
    d: { configPath: '' },
    html: 
     { indent_inner_html: false,
       indent_size: 4,
       indent_char: ' ',
       brace_style: 'collapse',
       indent_scripts: 'normal',
       wrap_line_length: 250,
       wrap_attributes: 'auto',
       wrap_attributes_indent_size: 4,
       preserve_newlines: true,
       max_preserve_newlines: 10,
       unformatted: [Object],
       end_with_newline: false },
    java: { configPath: '' },
    js: 
     { indent_size: 4,
       indent_char: ' ',
       indent_level: 0,
       indent_with_tabs: false,
       preserve_newlines: true,
       max_preserve_newlines: 10,
       space_in_paren: false,
       jslint_happy: false,
       space_after_anon_function: false,
       brace_style: 'collapse',
       break_chained_methods: false,
       keep_array_indentation: false,
       keep_function_indentation: false,
       space_before_conditional: true,
       eval_code: false,
       unescape_strings: false,
       wrap_line_length: 0,
       end_with_newline: false },
    objectivec: { configPath: '' },
    pawn: { configPath: '' },
    perl: { perltidy_profile: '' },
    python: { max_line_length: 79, indent_size: 4, ignore: [Object] },
    sql: { indent_size: 4, keywords: 'upper', identifiers: 'lower' },
    vala: { configPath: '' } },
  { _default: {} },
  { _bitField: 536870912,
    _fulfillmentHandler0: undefined,
    _rejectionHandler0: 
     { _bitField: 0,
       _fulfillmentHandler0: undefined,
       _rejectionHandler0: undefined,
       _progressHandler0: undefined,
       _promise0: undefined,
       _receiver0: undefined,
       _settledValue: undefined },
    _progressHandler0: undefined,
    _promise0: undefined,
    _receiver0: undefined,
    _settledValue: undefined },
  { _default: {} },
  { _default: {} },
  { _default: {} },
  { _default: {} },
  { _default: {} } ] PHP C:\htdocs\monitor\application\views\emails\pedido.php
2015-05-20T07:52:32.618Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee]  indent_size=4, indent_char= , indent_with_tabs=false, cs_fixer_path=C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar, fixers=, level=, configPath=, configPath=, configPath=, indent_size=4, indent_char= , selector_separator_newline=false, newline_between_rules=false, preserve_newlines=false, configPath=, indent_inner_html=false, indent_size=4, indent_char= , brace_style=collapse, indent_scripts=normal, wrap_line_length=250, wrap_attributes=auto, wrap_attributes_indent_size=4, preserve_newlines=true, max_preserve_newlines=10, unformatted=[a, sub, sup, b, i, u], end_with_newline=false, configPath=, indent_size=4, indent_char= , indent_level=0, indent_with_tabs=false, preserve_newlines=true, max_preserve_newlines=10, space_in_paren=false, jslint_happy=false, space_after_anon_function=false, brace_style=collapse, break_chained_methods=false, keep_array_indentation=false, keep_function_indentation=false, space_before_conditional=true, eval_code=false, unescape_strings=false, wrap_line_length=0, end_with_newline=false, configPath=, configPath=, perltidy_profile=, max_line_length=79, indent_size=4, ignore=[E24], indent_size=4, keywords=upper, identifiers=lower, configPath=, , _bitField=536870912, _fulfillmentHandler0=undefined, _bitField=0, _fulfillmentHandler0=undefined, _rejectionHandler0=undefined, _progressHandler0=undefined, _promise0=undefined, _receiver0=undefined, _settledValue=undefined, _progressHandler0=undefined, _promise0=undefined, _receiver0=undefined, _settledValue=undefined, , , , , 
2015-05-20T07:52:32.619Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] [ 'php' ] indent_size=4, indent_char= , indent_with_tabs=false, cs_fixer_path=C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar, fixers=, level=, configPath=, configPath=, configPath=, indent_size=4, indent_char= , selector_separator_newline=false, newline_between_rules=false, preserve_newlines=false, configPath=, indent_inner_html=false, indent_size=4, indent_char= , brace_style=collapse, indent_scripts=normal, wrap_line_length=250, wrap_attributes=auto, wrap_attributes_indent_size=4, preserve_newlines=true, max_preserve_newlines=10, unformatted=[a, sub, sup, b, i, u], end_with_newline=false, configPath=, indent_size=4, indent_char= , indent_level=0, indent_with_tabs=false, preserve_newlines=true, max_preserve_newlines=10, space_in_paren=false, jslint_happy=false, space_after_anon_function=false, brace_style=collapse, break_chained_methods=false, keep_array_indentation=false, keep_function_indentation=false, space_before_conditional=true, eval_code=false, unescape_strings=false, wrap_line_length=0, end_with_newline=false, configPath=, configPath=, perltidy_profile=, max_line_length=79, indent_size=4, ignore=[E24], indent_size=4, keywords=upper, identifiers=lower, configPath=, , _bitField=536870912, _fulfillmentHandler0=undefined, _bitField=0, _fulfillmentHandler0=undefined, _rejectionHandler0=undefined, _progressHandler0=undefined, _promise0=undefined, _receiver0=undefined, _settledValue=undefined, _progressHandler0=undefined, _promise0=undefined, _receiver0=undefined, _settledValue=undefined, , , , , 
2015-05-20T07:52:32.620Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true indent_size=4, indent_char= , indent_with_tabs=false
2015-05-20T07:52:32.620Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php undefined
2015-05-20T07:52:32.620Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php indent_size=4, indent_char= , indent_with_tabs=false
2015-05-20T07:52:32.620Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true cs_fixer_path=C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar, fixers=, level=, configPath=, configPath=, configPath=, indent_size=4, indent_char= , selector_separator_newline=false, newline_between_rules=false, preserve_newlines=false, configPath=, indent_inner_html=false, indent_size=4, indent_char= , brace_style=collapse, indent_scripts=normal, wrap_line_length=250, wrap_attributes=auto, wrap_attributes_indent_size=4, preserve_newlines=true, max_preserve_newlines=10, unformatted=[a, sub, sup, b, i, u], end_with_newline=false, configPath=, indent_size=4, indent_char= , indent_level=0, indent_with_tabs=false, preserve_newlines=true, max_preserve_newlines=10, space_in_paren=false, jslint_happy=false, space_after_anon_function=false, brace_style=collapse, break_chained_methods=false, keep_array_indentation=false, keep_function_indentation=false, space_before_conditional=true, eval_code=false, unescape_strings=false, wrap_line_length=0, end_with_newline=false, configPath=, configPath=, perltidy_profile=, max_line_length=79, indent_size=4, ignore=[E24], indent_size=4, keywords=upper, identifiers=lower, configPath=
2015-05-20T07:52:32.620Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php cs_fixer_path=C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar, fixers=, level=
2015-05-20T07:52:32.620Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php cs_fixer_path=C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar, fixers=, level=
2015-05-20T07:52:32.620Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true 
2015-05-20T07:52:32.621Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php undefined
2015-05-20T07:52:32.621Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php
2015-05-20T07:52:32.621Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] false _bitField=536870912, _fulfillmentHandler0=undefined, _bitField=0, _fulfillmentHandler0=undefined, _rejectionHandler0=undefined, _progressHandler0=undefined, _promise0=undefined, _receiver0=undefined, _settledValue=undefined, _progressHandler0=undefined, _promise0=undefined, _receiver0=undefined, _settledValue=undefined
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php undefined
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true 
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php undefined
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true 
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php undefined
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true 
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php undefined
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php
2015-05-20T07:52:32.622Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true 
2015-05-20T07:52:32.623Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php undefined
2015-05-20T07:52:32.623Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php
2015-05-20T07:52:32.623Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] true 
2015-05-20T07:52:32.623Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php undefined
2015-05-20T07:52:32.623Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options php
2015-05-20T07:52:32.623Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] PHP name=PHP, namespace=php, grammars=[PHP], extensions=[php], type=string, default=, description=Add fixer(s). i.e. linefeed,-short_tag,indentation (Supported by PHP-CS-Fixer), title=PHP - Fixers, beautifiers=[PHP-CS-Fixer], type=string, default=, description=By default, all PSR-2 fixers and some additional ones are run. (Supported by PHP-CS-Fixer), title=PHP - Level, beautifiers=[PHP-CS-Fixer], beautifiers=[PHP-CS-Fixer]
2015-05-20T07:52:32.623Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] options indent_size=4, indent_char= , indent_with_tabs=false, cs_fixer_path=C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar, fixers=, level=
2015-05-20T07:52:32.623Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] beautifiers silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, languages=[PHP]
2015-05-20T07:52:32.623Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] PHP C:\htdocs\monitor\application\views\emails\pedido.php { indent_size: 4,
  indent_char: ' ',
  indent_with_tabs: false,
  cs_fixer_path: 'C:\\php-5.5.3-Win32-VC11-x64\\php-cs-fixer.phar',
  fixers: '',
  level: '' } indent_size=4, indent_char= , indent_with_tabs=false, cs_fixer_path=C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar, fixers=, level=, configPath=, configPath=, configPath=, indent_size=4, indent_char= , selector_separator_newline=false, newline_between_rules=false, preserve_newlines=false, configPath=, indent_inner_html=false, indent_size=4, indent_char= , brace_style=collapse, indent_scripts=normal, wrap_line_length=250, wrap_attributes=auto, wrap_attributes_indent_size=4, preserve_newlines=true, max_preserve_newlines=10, unformatted=[a, sub, sup, b, i, u], end_with_newline=false, configPath=, indent_size=4, indent_char= , indent_level=0, indent_with_tabs=false, preserve_newlines=true, max_preserve_newlines=10, space_in_paren=false, jslint_happy=false, space_after_anon_function=false, brace_style=collapse, break_chained_methods=false, keep_array_indentation=false, keep_function_indentation=false, space_before_conditional=true, eval_code=false, unescape_strings=false, wrap_line_length=0, end_with_newline=false, configPath=, configPath=, perltidy_profile=, max_line_length=79, indent_size=4, ignore=[E24], indent_size=4, keywords=upper, identifiers=lower, configPath=, , _bitField=536870912, _fulfillmentHandler0=undefined, _bitField=0, _fulfillmentHandler0=undefined, _rejectionHandler0=undefined, _progressHandler0=undefined, _promise0=undefined, _receiver0=undefined, _settledValue=undefined, _progressHandler0=undefined, _promise0=undefined, _receiver0=undefined, _settledValue=undefined, , , , , 
2015-05-20T07:52:32.624Z - verbose: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\index.coffee] beautifier PHP-CS-Fixer silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, languages=[PHP]
2015-05-20T07:52:32.624Z - debug: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] php-cs-fixer indent_size=4, indent_char= , indent_with_tabs=false, cs_fixer_path=C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar, fixers=, level=
2015-05-20T07:52:32.636Z - debug: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] tempFile temp null path=C:\Users\Guillem\AppData\Local\Temp\temp115420-9660-18cbt6f, fd=0
2015-05-20T07:52:32.647Z - debug: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn php-cs-fixer 0=fix, 1=C:\Users\Guillem\AppData\Local\Temp\temp115420-9660-18cbt6f
2015-05-20T07:52:32.648Z - debug: [C:\Users\Guillem\.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] error Error: spawn php-cs-fixer ENOENT
  at exports._errnoException (util.js:734:11)
  at Process.ChildProcess._handle.onexit (child_process.js:1035:32)
  at child_process.js:1127:20
  at process._tickCallback (node.js:357:13)


@Glavin001
Copy link
Owner

Published fix to v0.27.3

Please let me know if that works.

@CyberPunkCodes
Copy link

I don't know that this should be closed before anyone can give feedback. This still is not working for me, and it is not giving any error now. It just pops up a window for half a second, and does nothing. So I ran the Beautify debug to look at the contents:

spawn php 0=php-cs-fixer.phar, 1=fix, 2=C:\Users\Wade\AppData\Local\Temp\temp115420-5796-1a4jclr
spawn done 1  Could not open input file: php-cs-fixer.phar

NOTE: I can run php-cs-fixer --version and it works (reports version). However, if I try php php-cs-fixer.phar --version it does not find it. I installed with composer, so I don't have anything for php-cs-fixer in my WAMP php directory, It is in my composer's vendor/bin directory. So this might work for someone who can run it via php command.

I have been programming for a long time, but I am fairly new to Composer, Git, and all that. So I could have missed something along the way. I don't think that anyone who used Composer to install php-cs-fixer would have the files anywhere else either, unless they manually moved them? So I don't see how this would work out of the box installing via Composer.

@Glavin001
Copy link
Owner

I don't know that this should be closed before anyone can give feedback.

I close issues via commit messages, so that is automatic. It is trivial to reopen an issue, if it does not work.

I can run php-cs-fixer --version and it works (reports version)

This is strange, that should not work on Windows. From my experience (see #269 ), Windows requires running php as the executable and evaluating the php-cs-fixer.phar php script. If this does work, then simply fixing the PATH environment variable should be all that is required for Node.js to find the executable php-cs-fixer and run it.

For Windows, I have added back the option php_cs_fixer_path such that you can manually set the path to php-cs-fixer.phar file. For instance, @guillempascual's value for PHP CS Fixer Path is C:\\php-5.5.3-Win32-VC11-x64\\php-cs-fixer.phar.

The applicable code can be found here:

isWin = /^win/.test(process.platform)
if isWin
@run("php", [
options.cs_fixer_path or "php-cs-fixer.phar"
"fix"
"--level=#{options.level}" if options.level
"--fixers=#{options.fixers}" if options.fixers
tempFile = @tempFile("temp", text)
], {ignoreReturnCode: true})
.then(=>
@readFile(tempFile)
)

I think at this point, I would recommend changing the arguments passed to @run yourself and do some debugging for your setup.

There may need to be multiple ways to handle different configurations on Windows, and since I do not even have a Windows computer to replicate any of them, I recommend that each of you attempt to simply change those values until it works for you and then let me know. Thank you.

@Glavin001 Glavin001 reopened this May 20, 2015
@CyberPunkCodes
Copy link

@Glavin001 I later thought it was closed automatically. After a few more tests, and after your update, I have gotten it working.

It seems impossible to get it working without using the php-cs-fixer.phar file itself, and setting the exact path in the atom-beautify settings within Atom. I have the paths in my Windows Environment for Composer's bin, PHP, NodeJS, Atom's bin, etc. For the most part, I don't play with the environment paths and they are set however the apps installed them (Atom, Composer, etc).

For the record, I am on Windows 8.1 64b. I hope to get a MacBook soon, but for now it isn't possible. Normal programming wasn't a problem in the past, but using Composer, Git, and various other new technologies have made Mac's more and more desirable. It seems they are all made for Mac, and Windows second. On top of Mac's having a similar structure to Linux servers, as they are Unix based themselves.

How I got it working

I first downloaded the phar file from PHP-CS-Fixer on GitHub and placed it in my Composer's bin folder, right along with the files Composer installed (ie: php-cs-fixer executable).

In Atom, under Settings > Packages > Atom Beautify Settings: I scrolled down to where you can set the path for php-cs-fixer, and set it to: C:\Users\Wade\AppData\Roaming\Composer\vendor\bin\php-cs-fixer.phar

I also changed the psr level to psr2 while I was there.

Closed Atom and re-opened it. Loaded a php file and tested it. Boom, it's been Beautified :)

Maybe my problem the whole time was just not using the php-cs-fixer.phar file the whole time?

Unfortunately, I still can not run php php-cs-fixer.phar --version, PHP can't seem to find it for nothing. I thought about placing the phar directly in PHP's directory, but I just think it's messy throwing files all around. I think having it in the Composer directory should be enough, so I don't understand why PHP can't find it.

@Glavin001
Copy link
Owner

@guillempascual , to answer your questions:

-1. This module was working prior to 0.25. So the only change from 0.25 on was the detection of the env variables? If yes, I'll have to find out why setting manually the env var doesn't fix things.

There were major changes to the internal workings of Atom Beautify. See #282 for details, however even some of what is written there is outdated. Basically, I wanted to get rid of the manually setting of the paths for CLI beautifiers executables. With help from @ioquatix with https://github.com/ioquatix/script-runner I was able to make it work for Mac and Linux. However, Windows support is not yet there, at least for automatic detection of environment variables. I decided that we could just have the Windows users manually change their Init script for Atom (what you both did above) such that Atom Beautify, and all other applicable packages, would have a fixed PATH which would allow for the auto-detection of executables. However, for some reason, Windows is still causing problems...

-2. With Windows the main repetitive issue has been always that the command "php" has to be put before "php-cs-fixer.phar" for it to be executed. (CLI) Could it not be that the case now?

I accidently removed the php command when I rewrote the PHP CS Fixer beautifier. I have added it back now. See

isWin = /^win/.test(process.platform)
if isWin
@run("php", [
options.cs_fixer_path or "php-cs-fixer.phar"
"fix"
"--level=#{options.level}" if options.level
"--fixers=#{options.fixers}" if options.fixers
tempFile = @tempFile("temp", text)
], {ignoreReturnCode: true})
.then(=>
@readFile(tempFile)
)

I have also added back the option for setting the PHP CS Fixer Path manually, for Windows. Give this a try and let me know if that works for you.

-3 I'll dwell in the code, but first I should learn some concepts on Nodejs modules and coffescript. I've had located the code calling php-cs-fixer at src/php-cs-fixer.coffee. Any hints please? I cannot locate the call the PHP CLI.

If the PHP CS Fixer code is located at src/php-cs-fixer.coffee then you must be well out of date. Please update. It should be at src/beautifiers/php-cs-fixer.coffee.

I'll try and help best I can, but I think if these latest changes do not work, I recommend that each of you do your own testing and changing of the contents of the php-cs-fixer.coffee file. Since I cannot debug on Windows, until each of you are able to get it working, I cannot develop a final solution (if the latest does not work).

Thanks!

@guillempascual
Copy link
Author

Hey @Glavin001!! As of 0.27.4 now it works like a charm!!! Excellent job!! Thank you!!!
I even have deleted the manual ini configuration of the php-cs-fixer path and it seems to work.

As to where the source were located, my mistake, I meant src/beautifiers/php-cs-fixer.coffee, I really had the latest update.

Thank you.

@Glavin001
Copy link
Owner

Excellent! Thank you both for reporting back. Now that we have a working version, I can focus on making the experience easier for getting this configured by the user, such as:

  • detect if user is on Windows
    • if beautifying PHP, show notification explaining how to configure the PHP CS Fixer path
    • Improved error messages, see Gracefully handle errors when beautifier binary is not installed #311, etc
    • Atom Beautify attempt to guess and check file paths where php-cs-fixer.phar file might exist (Composer, etc) such that this could be configured automatically.

For the future, I think I would like to look into the ability to auto-detect installations and locations of the php-cs-fixer.phar file.
To confirm:

  • @WadeShuler your php-cs-fixer.phar file was located at C:\Users\Wade\AppData\Roaming\Composer\vendor\bin\php-cs-fixer.phar? I suppose this could be automatically detected from Composer with $HOME\AppData\Roaming\Composer\vendor\bin\php-cs-fixer.phar, and then check if that file exists. Thus I could likely handle Composer users automatically.
  • @guillempascual, you must have installed manually by downloading, instead of using Composer? Your path was C:\\php-5.5.3-Win32-VC11-x64\\php-cs-fixer.phar. Users like yourself, who manually installed, would receive the notification explaining how to configure. Was there a command you used to detect the path to php-cs-fixer.phar? I hear where.exe php-cs-fixer might work on Windows? which php-cs-fixer would be for Mac / Ubuntu, etc.

Thanks for the teamwork! Hopefully this will help other PHP and Atom Beautify users get started and the experience can be improved for the future.

@guillempascual
Copy link
Author

@Glavin001 yes I first tried Composer but something went wrong and Beautifier wasn't able to locate it so I switched to manual installation.
In win8.1 64b you can detect where is php-cs-fixer.phar as you said:

C:\Users\Guillem> where php-cs-fixer.phar => returns "C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar".

Thank you.
Best Regards,

@Glavin001
Copy link
Owner

Using where on Windows and which on Linux/Mac we might be able to make this automatic! Thanks! I'll keep look into this.

@fredukita
Copy link

fredukita commented May 25, 2016

I fixed it setting PHP-CS-FIXER PATH:
"C:\Users{username}\AppData\Roaming\Composer\vendor\fabpot\php-cs-fixer\php-cs-fixer"

@Glavin001
Copy link
Owner

I really want to focus on improving the installation experience for users. I have created a new Issue, #1687, to target this problem. Please provide your feedback! Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants