# @expreva/php-beautify

> Standalone tool to lint and format source files using PHP Code Sniffer and WordPress Code Standards running on PHP WebAssembly

Latest version **1.2.0** (published 2025-04-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @expreva/php-beautify
pnpm add @expreva/php-beautify
yarn add @expreva/php-beautify
bun add @expreva/php-beautify
```

Provides the command `php-beautify`.

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2025-04-05 |
| First published | 2023-12-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | eliot |

## Links

- npm: https://www.npmjs.com/package/@expreva/php-beautify
- Repository: https://github.com/expreva/php-beautify
- Issues: https://github.com/expreva/php-beautify/issues
- npm.io page: https://npm.io/package/@expreva/php-beautify

## Dependencies (2)

- [fast-glob](https://npm.io/package/fast-glob.md) ^3.3.3
- [@expreva/php-wasm-8-4](https://npm.io/package/@expreva/php-wasm-8-4.md) ^1.0.28

## Recent versions

- 1.2.0 (latest) — 2025-04-05
- 1.0.2 — 2023-12-11

## README

# PHP Beautify

This is a tool to lint and format source files in Node.js using PHP Code Sniffer and WordPress Code Standards. It bundles a PHP runtime compiled to WebAssembly, so it doesn't depend on PHP being installed on the local system.

## Install

### As global command

It can be installed as a global command.

```sh
npm install --global @expreva/php-beautify
```

### As dependency

Or install it as a dependency of an existing project.

```sh
npm install --save @expreva/php-beautify
```

In this case, use NPM script or `npx php-beautify` to run the commands described below.

#### Example of NPM script

```json
{
  "scripts" {
    "lint": "php-beautify lint src/**/*.php",
    "format": "php-beautify format src/**/*.php"
  }
}
```

## Usage

Help screen

```sh
php-beautify
```

Lint

```sh
php-beautify lint [...files]
```

Format

```sh
php-beautify format [...files]
```


## Included libraries

- [PHP WebAssembly](https://github.com/WordPress/wordpress-playground/tree/trunk/packages/php-wasm/node)

- [PHP Code Sniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer)

  ```sh
  curl -LO https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.11.3/phpcbf.phar
  curl -LO https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.11.3/phpcs.phar
  ```

- [WordPress Coding Standard](https://github.com/WordPress/WordPress-Coding-Standards)

  ```sh
  curl -L https://github.com/WordPress/WordPress-Coding-Standards/archive/refs/tags/3.1.0.tar.gz | tar zx
  mkdir -p wpcs
  for folder in WordPress WordPress-Core WordPress-Docs WordPress-Extra; do echo "Copying $folder"; rsync -r WordPress-Coding-Standards-*/"$folder"/ wpcs/"$folder"; done
  rm -rf WordPress-Coding-Standards-*
  ```

- Dependencies
  - [PHPCSUtils](https://github.com/PHPCSStandards/PHPCSUtils)

  ```sh
  curl -L https://github.com/PHPCSStandards/PHPCSUtils/archive/refs/tags/1.0.12.tar.gz | tar zx
  rsync -vr PHPCSUtils-*/PHPCSUtils/ wpcs/PHPCSUtils
  rm -rf PHPCSUtils-*
  ```

  - [PHPCSExtra](https://github.com/PHPCSStandards/PHPCSExtra)

  ```sh
  curl -L https://github.com/PHPCSStandards/PHPCSExtra/archive/refs/tags/1.2.1.tar.gz | tar zx
  for folder in Modernize NormalizedArrays Universal; do echo "Copying $folder"; rsync -r PHPCSExtra-*/"$folder"/ wpcs/"$folder"; done
  rm -rf PHPCSExtra-*
  ```

---
_Source: https://npm.io/package/@expreva/php-beautify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
