prettier/plugin-php

Name: plugin-php

Owner: Prettier

Description: Prettier PHP Plugin

Created: 2017-12-24 02:56:22.0

Updated: 2018-05-24 17:12:04.0

Pushed: 2018-05-12 15:17:02.0

Homepage: null

Size: 698

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

:construction: Work in Progress! :construction:

Prettier PHP

Prettier PHP Plugin

Gitter Travis npm version code style: prettier Follow+Prettier+on+Twitter

WORK IN PROGRESS

Please note that this plugin is currently in alpha stage and still under active development. We encourage everyone to try it and give feedback, but we don't recommend it for production use yet.

Intro

Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

This plugin adds support for the PHP language to Prettier.

Input
y_map(function($arg1,$arg2) use ( $var1, $var2 ) {
return $arg1+$arg2/($var+$var2);
rray("complex"=>"code","with"=>"inconsistent","formatting"=>"is", "hard" => "to", "maintain"=>true));
Output
y_map(
function ($arg1, $arg2) use ($var1, $var2) {
    return $arg1 + $arg2 / ($var + $var2);
},
array(
    "complex" => "code",
    "with" => "inconsistent",
    "formatting" => "is",
    "hard" => "to",
    "maintain" => true
)

Install

You'll need a current development version of prettier, because the plugin depends on currently unreleased features.

yarn:

 add --dev prettier/prettier prettier/plugin-php
 globally
 global add prettier/prettier prettier/plugin-php

npm:

install --save-dev prettier/prettier prettier/plugin-php
 globally
install --global prettier/prettier prettier/plugin-php
Use

If you installed prettier as a local dependency, you can add prettier as a script in your package.json,

ipts": {
rettier": "prettier"

and then run it via

 run prettier path/to/file.php --write

run prettier -- path/to/file.php --write

If you installed globally, run

tier path/to/file.php --write
Contributing

If you're interested in contributing to the development of Prettier for PHP, you can follow the CONTRIBUTING guide from Prettier, as it all applies to this repository too.

To test it out on a PHP file:

Maintainers

Mike Grip

Christian Zosel

Evilebot Tnawi

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.