# phplint

> phplint is a wrapper around the native php linter that allows for parallel linting and integration with build systems like Grunt, Gulp and more!

Latest version **2.0.5** (published 2021-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install phplint
pnpm add phplint
yarn add phplint
bun add phplint
```

Provides the command `phplint`.

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2021-04-01 |
| First published | 2014-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/phplint) |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 3 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 64 |
| Author | Wayne Ashley Berry |
| Maintainers | wayneashleyberry |
| Keywords | php, lint, phplint, gulpplugin, gulpfriendly, gruntplugin, gruntfriendly |

## Links

- npm: https://www.npmjs.com/package/phplint
- Repository: https://github.com/wayneashleyberry/phplint
- Homepage: https://github.com/wayneashleyberry/phplint#readme
- Issues: https://github.com/wayneashleyberry/phplint/issues
- npm.io page: https://npm.io/package/phplint

## Dependencies (3)

- [async](https://npm.io/package/async.md) ^2.6.0
- [globby](https://npm.io/package/globby.md) ^7.1.1
- [cache-swap](https://npm.io/package/cache-swap.md) ^0.3.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 2.0.5 (latest) — 2021-04-01
- 2.0.3 — 2020-07-16
- 2.0.2 — 2020-07-07
- 2.0.1 — 2018-08-16
- 2.0.0 — 2018-01-03
- 1.7.4 — 2017-03-30
- 1.7.3 — 2017-03-18
- 1.7.1 — 2016-02-21
- 1.7.0 — 2015-10-15
- 1.6.1 — 2015-08-17
- 1.6.0 — 2015-08-17
- 1.5.2 — 2015-07-08
- 1.5.1 — 2015-07-08
- 1.5.0 — 2015-04-08
- 1.4.0 — 2015-04-08
- … 20 more at https://npm.io/package/phplint/versions

## README

## phplint

> phplint is a node wrapper around the native php linter that allows for
> parallel linting and integration with build systems like
> [Grunt](http://gruntjs.com/), [Gulp](http://gulpjs.com/) and more.

[![Build Status](https://travis-ci.org/wayneashleyberry/phplint.svg?branch=main)](https://travis-ci.org/wayneashleyberry/phplint)
[![npm](http://img.shields.io/npm/v/phplint.svg?style=flat)](https://www.npmjs.com/package/phplint)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

### Usage

#### CLI

```sh
$ npm i -g phplint
$ phplint '**/*.php'
```

Paths and filenames are parsed using
[globby](https://github.com/sindresorhus/globby), so the following would work
as well:

```sh
$ phplint '**/*.php' '!vendor/**'
```

#### Node

```js
var phplint = require("phplint").lint;

phplint(["src/**/*.php"], function (err, stdout, stderr) {
  if (err) throw new Error(err);

  process.stdout.write(stdout);
  process.stderr.write(stderr);

  // success!
});
```

#### NPM

```json
{
  "scripts": {
    "pretest": "phplint 'src/**/*.php'"
  },
  "devDependencies": {
    "phplint": "~1.0.0"
  }
}
```

```sh
$ npm test
```

#### Grunt

##### Configure cache directories

This module uses the `cache-swap` module to cache already linted files.
You can configure the cache directories via the `cacheDirName` and the `tmpDir` options.
Both options will be passed to the CacheSwap instance when created.

```js
module.exports = function (grunt) {
  require("phplint").gruntPlugin(grunt);

  grunt.initConfig({
    phplint: {
      options: {
        limit: 10,
        phpCmd: "/home/scripts/php", // Defaults to php
        stdout: true,
        stderr: true,
        useCache: true, // Defaults to false
        tmpDir: "/custom/root/folder", // Defaults to os.tmpDir()
        cacheDirName: "custom/subfolder", // Defaults to php-lint
      },
      files: "src/**/*.php",
    },
  });

  grunt.registerTask("test", ["phplint"]);
};
```

```sh
$ grunt test
```

#### Gulp

The same options that can be used in Grunt can be used in Gulp too.

```js
var gulp = require("gulp");
var phplint = require("phplint").lint;

gulp.task("phplint", function (cb) {
  phplint(["src/**/*.php"], { limit: 10 }, function (err, stdout, stderr) {
    if (err) {
      cb(err);
      process.exit(1);
    }
    cb();
  });
});

gulp.task("test", ["phplint"]);
```

```sh
$ gulp test
```

### Related

- [phpl](https://github.com/wayneashleyberry/phpl)

### License

[MIT](http://opensource.org/licenses/MIT) © [Wayne Ashley Berry](https://wayne.cloud)

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