PHPackages                             mtolhuys/laravel-env-scanner - 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. mtolhuys/laravel-env-scanner

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

mtolhuys/laravel-env-scanner
============================

Checks environmental variables used in the env() and getenv() helper functions

1.5.3(6y ago)24162MITPHPPHP ^7.0CI failing

Since Jul 20Pushed 6y agoCompare

[ Source](https://github.com/mtolhuys/laravel-env-scanner)[ Packagist](https://packagist.org/packages/mtolhuys/laravel-env-scanner)[ Docs](https://github.com/mtolhuys/laravel-env-scanner)[ RSS](/packages/mtolhuys-laravel-env-scanner/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (21)Used By (0)

Laravel environmental variable scanner
======================================

[](#laravel-environmental-variable-scanner)

[![Latest Version on Packagist](https://camo.githubusercontent.com/78bdec0511b8e187a9a7357133bdf0360f4043786543562c43c442c368959277/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d746f6c687579732f6c61726176656c2d656e762d7363616e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mtolhuys/laravel-env-scanner)[![Build Status](https://camo.githubusercontent.com/d7950977116e9a258fc72f03a80cf829543275ccc466a91d8e9291dd38627379/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d746f6c687579732f6c61726176656c2d656e762d7363616e6e65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/mtolhuys/laravel-env-scanner)[![Quality Score](https://camo.githubusercontent.com/520130147b686d77fb87e29cc33e1cbfac6327905dd38864d1f309e41041ca64/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d746f6c687579732f6c61726176656c2d656e762d7363616e6e65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/mtolhuys/laravel-env-scanner)[![Total Downloads](https://camo.githubusercontent.com/b1efd8ae0d69a54d07a71f05678103682426e7ce6485b3434cd5b5bd23499504/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d746f6c687579732f6c61726176656c2d656e762d7363616e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mtolhuys/laravel-env-scanner)

This package comes with a `LaravelEnvScanner` class and artisan command which you can use to scan any folder in your app for potential .env related problems.

Example output of the command:

```
php artisan env:scan
Scanning: laravel-app/config...
2 undefined variable(s) found in laravel-app/config/...
+-------------------------------+----------+
| laravel-app/config/app.php:16 | APP_NAME |
| laravel-app/config/app.php:29 | APP_ENV  |
+-------------------------------+----------+
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require mtolhuys/laravel-env-scanner
```

Usage
-----

[](#usage)

You can call the artisan command to start the scan:

```
php artisan env:scan
```

Optionally you could specify a directory to run from (defaults to `config_path()`):

```
php artisan env:scan -d app/Http/Controllers
Scanning: app/Http/Controllers...
```

Or show all used variables:

```
php artisan env:scan -a
Scanning: laravel-app/config...
+------------------------------------+----------------+---------------------------+-------------------+
| Locations (2)                      | Defined (1)    | Depending on default (1)  | Undefined (0)     |
+------------------------------------+----------------+---------------------------+-------------------+
| laravel-app/config/database.php:36 | DB_CONNECTION  | -                         | -                 |
| laravel-app/config/database.php:42 | -              | DB_HOST                   | -                 |
+------------------------------------+----------------+---------------------------+-------------------+

php artisan env:scan -d app
Scanning: app...
Warning: env("RISKY_".$behavior) found in app/Http/Middleware/Authenticate.php

php artisan env:scan -d storage
Scanning: storage...
Looking good!
```

Aside from the command you can use the `LaravelEnvScanner` from anywhere you want:

```
(new LaravelEnvScanner(__DIR__))->scan()->results;

// Or

$this->scanner = new LaravelEnvScanner(__DIR__);
$this->scanner->scan();
$this->scanner->results;

// Example results
[
  "locations" => 1
  "defined" => 1
  "undefined" => 0
  "depending_on_default" => 0,
  "columns" => [
    0 => [
      "location" => "laravel-app/config/database.php:36"
      "defined" => "DB_HOST"
      "depending_on_default" => "-"
      "undefined" => "-"
    ]
  ]
]
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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)

- [Maarten Tolhuijs](https://github.com/mtolhuys)
- [All Contributors](../../contributors)
- [Beyond Code](https://github.com/beyondcode) For the [boilerplate](https://laravelpackageboilerplate.com/) and having me come up with the idea for this package.

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Total

20

Last Release

2477d ago

Major Versions

0.9.0 → 1.0.02019-07-20

PHP version history (2 changes)0.9.0PHP ^7.1

1.4.4PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f86a601f247298c0f4beb73d0fd47aca41551ad230c4a0ff9cdab56ddc0d55f?d=identicon)[mtolhuijs](/maintainers/mtolhuijs)

---

Top Contributors

[![mtolhuys](https://avatars.githubusercontent.com/u/10849136?v=4)](https://github.com/mtolhuys "mtolhuys (37 commits)")

---

Tags

mtolhuyslaravel-env-scanner

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mtolhuys-laravel-env-scanner/health.svg)

```
[![Health](https://phpackages.com/badges/mtolhuys-laravel-env-scanner/health.svg)](https://phpackages.com/packages/mtolhuys-laravel-env-scanner)
```

###  Alternatives

[vjik/php-enum

PHP Enum Implementation

209.9k](/packages/vjik-php-enum)[iiifx-production/ukraine-identification-number

Ukraine Identification Number

117.3k](/packages/iiifx-production-ukraine-identification-number)

PHPackages © 2026

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