PHPackages                             lumensistemas/lens - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. lumensistemas/lens

ActiveLibrary[Testing &amp; Quality](/categories/testing)

lumensistemas/lens
==================

Lumen's PHP code-quality conventions, baked in. Wraps php-cs-fixer, Rector and PHPStan with shipped config.

1.0.4(2w ago)0144↓100%MITPHPPHP ^8.3CI passing

Since Apr 25Pushed 2w agoCompare

[ Source](https://github.com/lumensistemas/lens)[ Packagist](https://packagist.org/packages/lumensistemas/lens)[ Docs](https://github.com/lumensistemas/lens)[ RSS](/packages/lumensistemas-lens/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (5)Dependencies (9)Versions (7)Used By (0)

lens
====

[](#lens)

[![Build](https://github.com/lumensistemas/lens/actions/workflows/lens.yml/badge.svg?branch=main)](https://github.com/lumensistemas/lens/actions/workflows/lens.yml)[![Packagist Version](https://camo.githubusercontent.com/dcc6615d0eefcc4e73e012484fa33478ed7bafa7280d944d432a3c33ae934ed7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c756d656e73697374656d61732f6c656e73)](https://packagist.org/packages/lumensistemas/lens)[![Packagist Downloads](https://camo.githubusercontent.com/e290689900f9639b47c6b6053c754820a80944c6b67d1aaedfd82781bd4846ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c756d656e73697374656d61732f6c656e73)](https://packagist.org/packages/lumensistemas/lens)

Opinionated PHP code-quality conventions for [Lumen Sistemas](https://github.com/lumensistemas) products. One package that wraps php-cs-fixer, Rector and PHPStan with shipped configs; installing it gives a project the canonical Lumen rules, and bumping its version rolls those rules across every product in lockstep.

The reference points are Laravel Pint (single tool, opinionated, baked-in config) and Tighten Duster (multi-tool orchestrator). lens is closer to Pint in philosophy and closer to Duster in shape.

Install
-------

[](#install)

Requires PHP 8.3+ and `git` on PATH (for `--dirty`).

```
composer require --dev lumensistemas/lens
```

The package installs a self-contained PHAR at `vendor/bin/lens`. None of the wrapped tools (php-cs-fixer, Rector, PHPStan, Larastan, symfony components) land in your project's `vendor/` — they are bundled inside the PHAR and extracted on first run to `~/.cache/lens//`. The cache is fingerprinted against the PHAR's signature, so swapping `builds/lens` for a newer build auto-invalidates without manual cleanup. There are no version conflicts to resolve against your application's dependency tree.

Use
---

[](#use)

```
vendor/bin/lens check            # run all linters in check mode
vendor/bin/lens fix              # apply automatic fixes, then verify with phpstan
vendor/bin/lens cs-fixer [--fix] # single tool, --fix toggles write mode
vendor/bin/lens rector   [--fix]
vendor/bin/lens phpstan
```

Useful flags:

```
--dirty       only files changed vs. the merge-base with main
--ci          GitHub-style annotations
--using=…     comma-separated subset, e.g. --using=phpstan,rector
              (an unknown name fails fast — no silent skip)
--base=  git base ref for --dirty (default origin/main)

```

`lens check` returns the worst exit code across drivers, so a single non-zero result fails CI without you needing to chain commands.

`--dirty` is strict: missing git, missing repo, or an unfetched base ref each fail loud. CI configurations using shallow clones should `git fetch origin ` (or use `actions/checkout@v4` with `fetch-depth: 0`).

One-time setup in a new project
-------------------------------

[](#one-time-setup-in-a-new-project)

```
vendor/bin/lens init                          # write lens.json + phpstan baseline
vendor/bin/lens publish:workflow --package    # drop .github/workflows/tests.yml (lint + test matrix)
```

`init` is opt-in. lens runs without `lens.json` — it auto-detects the standard Laravel layout (`app`, `bootstrap`, `config`, `database`, `resources`, `routes`, `tests`, `src`) and analyses whichever of those exist in the project root.

lens.json — the override surface
--------------------------------

[](#lensjson--the-override-surface)

By design, `lens.json` only configures *boundaries*, never rules. The rules themselves live inside the package and change for every product when lens is bumped.

```
{
    "paths": ["app", "database", "routes", "tests"],
    "phpstan": {
        "baseline": "phpstan-baseline.neon"
    }
}
```

keypurpose`paths`dirs each tool analyses (default: detected)`phpstan.baseline`optional phpstan baseline file at the project rootThe shipped configs already exclude the universal cases (`vendor`, `storage`, `bootstrap/cache`, `node_modules`) globally — there is no per-project `exclude` knob today.

Any other key is rejected with a clear error. If you find yourself wanting to disable a rule, the path is to open a PR against lens itself — not to override locally. That is the point.

CI
--

[](#ci)

`lens publish:workflow --package` drops a GitHub Actions workflow at `.github/workflows/tests.yml` that installs PHP, runs `lens check --ci` for lint, and runs a `composer test:coverage` matrix across supported PHP versions and stability profiles on Ubuntu and Windows. Wire it into your pull-request branch protection.

`--package` is required: today this command only deploys the package matrix workflow. The flag declares intent and reserves room for other workflow shapes later.

Convention philosophy
---------------------

[](#convention-philosophy)

Lumen's operating principles include "conventions over decisions" and "consistency over cleverness". lens exists so the same PHP code-quality decisions don't get re-litigated per project, and so a single `composer update lumensistemas/lens` propagates the canonical config to every product on the same day.

The corollary: if you find a real exception that the convention should permit, the right move is to update the convention, not to work around it locally.

Development
-----------

[](#development)

```
git clone https://github.com/lumensistemas/lens
cd lens
composer install
composer test         # pest, ~8s (4 subprocess-tagged tests)
composer lens         # run lens check against itself
composer run build    # rebuild builds/lens (the PHAR)
```

The PHAR is built from `composer-build.json` (runtime tools as `require`, no dev) into a staged `build/` working dir, then written to `builds/lens` and committed. CI rebuilds on every push and verifies via the freshly-built PHAR rather than source.

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance96

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~6 days

Total

5

Last Release

20d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dfdf6591a8b2d844569545878fba113e9c8de3d9b9d48f5b25637c6f0353ffbd?d=identicon)[lucasvscn](/maintainers/lucasvscn)

---

Top Contributors

[![lucasvscn](https://avatars.githubusercontent.com/u/3482569?v=4)](https://github.com/lucasvscn "lucasvscn (31 commits)")

---

Tags

PHPStanlaravelstatic analysislumenlintrectorphp-cs-fixer

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lumensistemas-lens/health.svg)

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

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

15104.9k4](/packages/calebdw-larastan)

PHPackages © 2026

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