Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Prettier PHP Plugin Browser Example</title>
  
  <!-- this script define the global `prettier` -->
  <script src="https://unpkg.com/prettier/standalone.js"></script>
  <script src="https://prettier-php-standalone-felsmoypfq.now.sh/php-standalone.js"></script>
</head>
<body>
<pre>
<code>
&lt;?php
namespace
Foo;
      class Bar {
        protected $a    =
           4
;
            public function baz(
            ) { return null; }
         }
</code>
</pre>
  <button>Format</button>
  <script>
    var code = document.querySelector("code");
    var button = document.querySelector("button");
    button.onclick = function() {
      code.textContent = prettier.format(
        code.textContent,
        {
          plugins: [prettier_pluginPhp],
          parser: "php"
        }
      )
    }
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
Loilopro
0viewers