PHPackages                             tightenco/tlint - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tightenco/tlint

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tightenco/tlint
===============

Tighten linter for Laravel conventions

v9.5.0(1y ago)5271.2M—10%32[1 PRs](https://github.com/tighten/tlint/pulls)20MITPHPPHP &gt;=8.1CI passing

Since Apr 21Pushed 2mo ago12 watchersCompare

[ Source](https://github.com/tighten/tlint)[ Packagist](https://packagist.org/packages/tightenco/tlint)[ Docs](https://github.com/tighten/tlint)[ RSS](/packages/tightenco-tlint/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (88)Used By (20)

[![TLint Logo](https://raw.githubusercontent.com/tighten/tlint/master/tlint-banner.png)](https://raw.githubusercontent.com/tighten/tlint/master/tlint-banner.png)

---

[![Latest Version on Packagist](https://camo.githubusercontent.com/68d24a84c6c17304c132a6ee6c57f89fa0228eeb2afef89ee6a9f837a2e1e7a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7469676874656e636f2f746c696e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tightenco/tlint)

Install (Requires PHP 8.1+)
---------------------------

[](#install-requires-php-81)

> **Note**TLint is intended to work with the tools included in [Duster](https://github.com/tighten/duster). To receive the best coverage we recommend using Duster to install and configure TLint.

```
# Include in project
composer require tightenco/tlint --dev

# Include globally
composer global require tightenco/tlint
```

Upgrade
-------

[](#upgrade)

```
# Upgrade in project
composer update tightenco/tlint

#Upgrade globally
composer global update tightenco/tlint
```

### Upgrading from 8.x to 9.x

[](#upgrading-from-8x-to-9x)

TLint 9 requires PHP &gt;= 8.1.

`tformat.json` has been dropped in favor of a single `tlint.json` file.

Now linting the following files and directories:

- `public/`
- `bootstrap/`
- `server.php`
- `app/Http/Middleware/RedirectIfAuthenticated.php`
- `Exceptions/Handler.php`
- `app/Http/Controllers/Auth/`
- `app/Http/Kernel.php`

To continue excluding these files and directories add them to your `tlint.json` file under `excluded`.

### Upgrading from 7.x to 8.x

[](#upgrading-from-7x-to-8x)

A significant number of formatters were added between the 7.x and 8.x releases. If you want to roll these out gradually or disable them altogether, you can use the `disabled` setting in your `tlint.json` config.

### Upgrading from 6.x to 7.x

[](#upgrading-from-6x-to-7x)

TLint focuses on linting and formatting issues other tools are not able to catch. The `7.x` release removes lints and formatters covered by tools in [Duster](https://github.com/tighten/duster). If you need to add these back you can grab them from an earlier version of TLint and follow the [Custom Configuration](#custom-configuration--presets) documentation.

What Is It?
-----------

[](#what-is-it)

This is an opinionated code linter (with growing support for auto-formatting!) for Tighten flavored code conventions for Laravel and PHP.

For example, Laravel has many available ways to pass variables from a controller to a view:

> **A)**

```
$value = 'Hello, World!';

return view('view', compact('value'));
```

> **B)**

```
return view('view', ['value' => 'Hello, World!']);
```

> **C)**

```
return view('view')
    ->with('value', 'Hello, World!');
```

In this case TLint will warn if you are not using the **B)** method. This example is a sort of "meta layer" of code linting, allowing teams to avoid higher level sticking points of code review / discussions.

Usage
-----

[](#usage)

For entire project (you must pass the lint command to use other options)

```
tlint

```

For individual files and specific directories

```
tlint lint index.php
tlint lint app

```

You can also lint only diff files by running the following with unstaged git changes

```
tlint lint --diff
tlint lint src --diff

```

Want the output from a file as JSON? (Primarily used for integration with editor plugins)

```
tlint lint test.php --json

```

Want the output from a file as a [checkstyle XML report](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.22.0/doc/schemas/fix/checkstyle.xsd)? (Primarily used with CI tools like [reviewdog](https://github.com/reviewdog/reviewdog) and [cs2pr](https://github.com/staabm/annotate-pull-request-from-checkstyle))

```
tlint lint test.php --checkstyle

```

Want to only run a single linter?

```
tlint lint --only=ArrayParametersOverViewWith

```

Example Output
--------------

[](#example-output)

```
Linting TestLaravelApp/routes/web.php
============
Lints:
============
! Prefer `view(...)->with(...)` over `view(..., [...])`.
5 : `    return view('test', ['test' => 'test']);``
```

Formatting
----------

[](#formatting)

Using the same conventions as above, but using the format command, you can auto-fix some lints:

```
tlint format

```

Linting Configuration
---------------------

[](#linting-configuration)

TLint Ships with 2 "preset" styles: Laravel &amp; Tighten. The Laravel preset is intended to match the conventions agreed upon by the Laravel framework contributors, while the Tighten preset is intended to match those agreed upon by Tighten team members.

The default configuration is "tighten" flavored, but you may change this by adding a `tlint.json` file to your project's root directory with the following schema:

> You may further customize the linters used by adding specific lint names to the `"disabled"` list. You may disable linting for specific directories by adding them to the `"excluded"` list. You may provide custom paths by adding them to the `"paths"` lists.

```
{
    "preset": "laravel",
    "disabled": ["ArrayParametersOverViewWith"],
    "excluded": ["tests/"],
    "paths": [
        {
            "controllers": ["app/Domain/Http/Controllers"]
        }
    ]
}
```

### Custom Configuration &amp; Presets

[](#custom-configuration--presets)

You can also add your own custom preset and linters by providing a fully-qualified class name as the preset. For example, if you created a custom preset class:

```
namespace App\Support\Linting;

use Tighten\TLint\Presets\PresetInterface;

class Preset implements PresetInterface
{
  public function getLinters() : array
  {
    return [
      CustomLinter::class,
    ];
  }

  public function getFormatters() : array
  {
    return [
        CustomFormatter::class,
    ];
  }
}
```

Then your config could look like:

```
{
    "preset": "App\\Support\\Linting\\Preset"
}
```

This lets you define custom linting/formatting functionality, or modify the existing linters/formatters to your liking.

Editor Integrations
-------------------

[](#editor-integrations)

### [PHPStorm](https://plugins.jetbrains.com/plugin/10703-tlint)

[](#phpstorm)

[![](tlint-phpstorm.png)](tlint-phpstorm.png)

### [Sublime](https://packagecontrol.io/packages/SublimeLinter-contrib-tlint)

[](#sublime)

[![](tlint-sublime.png)](tlint-sublime.png)

### [VSCode](https://marketplace.visualstudio.com/items?itemName=d9705996.tighten-lint)

[](#vscode)

[![](tlint-vscode.png)](tlint-vscode.png)

Available Linters
-----------------

[](#available-linters)

LinterDescription`ApplyMiddlewareInRoutes`Apply middleware in routes (not controllers).`ArrayParametersOverViewWith`Prefer `view(..., [...])` over `view(...)->with(...)`.`FullyQualifiedFacades`Import facades using their full namespace.`MailableMethodsInBuild`Mailable values (from and subject etc) should be set in build().`NoDatesPropertyOnModels`The `$dates` property was deprecated in Laravel 8. Use `$casts` instead.`NoDocBlocksForMigrationUpDown`Remove doc blocks from the up and down method in migrations.`NoDumpDirectives`Do not use the `@dump` or `@dd` directives.`NoJsonDirective`Use blade `{{ $model }}` auto escaping for models, and double quotes via json\_encode over @json blade directive: `` -&gt; `` OR ```NoRayDirective`Do not use the `@ray` directive.`NoLeadingSlashesOnRoutePaths`No leading slashes on route paths.`NoRequestAll`No `request()->all()`. Use `request()->only(...)` to retrieve specific input values.`NoSpaceAfterBladeDirectives`No space between blade template directive names and the opening paren:`@section (` -&gt; `@section(``OneLineBetweenClassVisibilityChanges`Class members of differing visibility must be separated by a blank line`PureRestControllers`You should not mix restful and non-restful public methods in a controller`QualifiedNamesOnlyForClassName`Fully Qualified Class Names should only be used for accessing class names`RemoveLeadingSlashNamespaces`Prefer `Namespace\...` over `\Namespace\...`.`RequestHelperFunctionWherePossible`Use the request(...) helper function directly to access request values wherever possible`RequestValidation`Use `request()->validate(...)` helper function or extract a FormRequest instead of using `$this->validate(...)` in controllers`SpaceAfterBladeDirectives`Put a space between blade control structure names and the opening paren:`@if(` -&gt; `@if (``SpacesAroundBladeRenderContent`Spaces around blade rendered content:`{{1 + 1}}` -&gt; `{{ 1 + 1 }}``UseAnonymousMigrations`Prefer anonymous class migrations.### General PHP

[](#general-php)

- `OneLineBetweenClassVisibilityChanges`
- `QualifiedNamesOnlyForClassName`
- `RemoveLeadingSlashNamespaces`

### Laravel

[](#laravel)

- `ApplyMiddlewareInRoutes`
- `ArrayParametersOverViewWith`
- `FullyQualifiedFacades`
- `MailableMethodsInBuild`
- `NoLeadingSlashesOnRoutePaths`
- `NoDocBlocksForMigrationUpDown`
- `NoDumpDirectives`
- `NoJsonDirective`
- `NoRayDirective`
- `NoSpaceAfterBladeDirectives`, `SpaceAfterBladeDirectives`
- `PureRestControllers`
- `RequestHelperFunctionWherePossible`
- `RequestValidation`
- `SpacesAroundBladeRenderContent`
- `UseAnonymousMigrations`

Available Formatters
--------------------

[](#available-formatters)

**Notes about formatting**

- Formatting is designed to alter the least amount of code possible.
- Import related formatters are not designed to alter grouped imports.

FormatterDescription`ArrayParametersOverViewWith`Prefer `view(..., [...])` over `view(...)->with(...)`.`FullyQualifiedFacades`Import facades using their full namespace.`MailableMethodsInBuild`Mailable values (from and subject etc) should be set in build().`NoDatesPropertyOnModels`Use `$casts` instead of `$dates` on Eloquent models.`NoDocBlocksForMigrationUpDown`Removes doc blocks from the up and down method in migrations.`NoLeadingSlashesOnRoutePaths`No leading slashes on route paths.`NoSpaceAfterBladeDirectives`No space between blade template directive names and the opening paren:`@section (` -&gt; `@section(``OneLineBetweenClassVisibilityChanges`Class members of differing visibility must be separated by a blank line`RemoveLeadingSlashNamespaces`Prefer `Namespace\...` over `\Namespace\...`.`RequestHelperFunctionWherePossible`Use the request(...) helper function directly to access request values wherever possible`RequestValidation`Use `request()->validate(...)` helper function or extract a FormRequest instead of using `$this->validate(...)` in controllers`SpaceAfterBladeDirectives`Put a space between blade control structure names and the opening paren:`@if(` -&gt; `@if (``SpacesAroundBladeRenderContent`Spaces around blade rendered content:`{{1 + 1}}` -&gt; `{{ 1 + 1 }}``UseAnonymousMigrations`Prefer anonymous class migrations.### General PHP

[](#general-php-1)

- `OneLineBetweenClassVisibilityChanges`
- `RemoveLeadingSlashNamespaces`

### Laravel

[](#laravel-1)

- `ArrayParametersOverViewWith`
- `FullyQualifiedFacades`
- `MailableMethodsInBuild`
- `NoDatesPropertyOnModels`
- `NoDocBlocksForMigrationUpDown`
- `NoLeadingSlashesOnRoutePaths`
- `NoSpaceAfterBladeDirectives`
- `RequestHelperFunctionWherePossible`
- `RequestValidation`
- `SpaceAfterBladeDirectives`
- `SpacesAroundBladeRenderContent`
- `UseAnonymousMigrations`

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Logan Henson](https://github.com/loganhenson)
- [Jacob Baker-Kretzmar](https://github.com/bakerkretzmar)
- [Anthony Clark](https://github.com/driftingly)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

68

—

FairBetter than 100% of packages

Maintenance67

Regular maintenance activity

Popularity60

Solid adoption and visibility

Community43

Growing community involvement

Maturity88

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~34 days

Recently: every ~110 days

Total

86

Last Release

423d ago

Major Versions

4.0.2 → 5.0.02020-06-18

v5.0.16 → v6.0.02021-04-23

v6.3.0 → v7.0.02022-11-02

v7.0.1 → v8.0.02023-01-06

v8.0.3 → v9.0.02023-07-11

PHP version history (5 changes)v1.0.0PHP &gt;=7.1

3.0.2PHP &gt;=7.2

5.0.0PHP &gt;=7.3

v7.0.0PHP &gt;=8.0

v9.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/151829?v=4)[Matt Stauffer](/maintainers/mattstauffer)[@mattstauffer](https://github.com/mattstauffer)

![](https://www.gravatar.com/avatar/7c147349739bf23edd28ef1587c7e4a8fefa3b8ed3d82392ad6e79125d0aac42?d=identicon)[loganhenson](/maintainers/loganhenson)

---

Top Contributors

[![loganhenson](https://avatars.githubusercontent.com/u/2792946?v=4)](https://github.com/loganhenson "loganhenson (366 commits)")[![driftingly](https://avatars.githubusercontent.com/u/194221?v=4)](https://github.com/driftingly "driftingly (271 commits)")[![bakerkretzmar](https://avatars.githubusercontent.com/u/18192441?v=4)](https://github.com/bakerkretzmar "bakerkretzmar (117 commits)")[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (33 commits)")[![sbine](https://avatars.githubusercontent.com/u/1902973?v=4)](https://github.com/sbine "sbine (22 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (16 commits)")[![inxilpro](https://avatars.githubusercontent.com/u/21592?v=4)](https://github.com/inxilpro "inxilpro (15 commits)")[![mattstauffer](https://avatars.githubusercontent.com/u/151829?v=4)](https://github.com/mattstauffer "mattstauffer (13 commits)")[![darkboywonder](https://avatars.githubusercontent.com/u/6867485?v=4)](https://github.com/darkboywonder "darkboywonder (8 commits)")[![EricTendian](https://avatars.githubusercontent.com/u/498525?v=4)](https://github.com/EricTendian "EricTendian (5 commits)")[![benholmen](https://avatars.githubusercontent.com/u/1056188?v=4)](https://github.com/benholmen "benholmen (4 commits)")[![mateusjunges](https://avatars.githubusercontent.com/u/19756164?v=4)](https://github.com/mateusjunges "mateusjunges (3 commits)")[![delta1186](https://avatars.githubusercontent.com/u/421307?v=4)](https://github.com/delta1186 "delta1186 (3 commits)")[![Wulfheart](https://avatars.githubusercontent.com/u/25671390?v=4)](https://github.com/Wulfheart "Wulfheart (3 commits)")[![jcorrego](https://avatars.githubusercontent.com/u/2152949?v=4)](https://github.com/jcorrego "jcorrego (3 commits)")[![jakebathman](https://avatars.githubusercontent.com/u/43112?v=4)](https://github.com/jakebathman "jakebathman (2 commits)")[![josecanhelp](https://avatars.githubusercontent.com/u/2329654?v=4)](https://github.com/josecanhelp "josecanhelp (2 commits)")[![igorgaming](https://avatars.githubusercontent.com/u/69463610?v=4)](https://github.com/igorgaming "igorgaming (2 commits)")[![tonysm](https://avatars.githubusercontent.com/u/1178621?v=4)](https://github.com/tonysm "tonysm (2 commits)")[![johnbacon](https://avatars.githubusercontent.com/u/308588?v=4)](https://github.com/johnbacon "johnbacon (1 commits)")

---

Tags

code-styleconventionslaravellinterphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tightenco-tlint/health.svg)

```
[![Health](https://phpackages.com/badges/tightenco-tlint/health.svg)](https://phpackages.com/packages/tightenco-tlint)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[roave/backward-compatibility-check

Tool to compare two revisions of a public API to check for BC breaks

5953.3M56](/packages/roave-backward-compatibility-check)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
