mtolhuys/laravel-env-scanner 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mtolhuys/laravel-env-scanner

Composer 安装命令:

composer require mtolhuys/laravel-env-scanner

包简介

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

README 文档

README

Latest Version on Packagist Build Status Quality Score Total Downloads

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

You can install the package via composer:

composer require mtolhuys/laravel-env-scanner

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

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 416
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固