salamikola/laravel-ddscanner
Composer 安装命令:
composer require salamikola/laravel-ddscanner
包简介
This package scans through laravel project to remove or comment out instances of dd/ddd function
README 文档
README
Laravel DDScanner is a laravel console package that scan and remove instances of dd() and ddd() function within a laravel project.Laravel DDScanner is built on top of laravel command and it utilises the power of the elegant laravel console.
Motivation
This package is inspired by an unforunate event, dd() slipped it way into production and all hell broke loose. The weekend after I have to create an artisan command in the CI/CD that can help prevent dd() from slipping into production. Long story short the command is now a package.
Installation
To get the latest version of Laravel-ddscanner on your project, require it from "composer":
$ composer require salamikola/laravel-ddscanner
Or you can add it directly in your composer.json file:
{
"require": {
"salamikola/laravel-ddscanner": "1.0*"
}
}
Laravel
Register the provider directly in your app configuration file config/app.php:
'providers' => [
// ...
Salamikola\LaravelDDScanner::class,
]
Usage
Go to the your project root terminal and enter the command below
php artisan dd:scanner
This will by default look for the app folder in your laravel root and scan recursively to the last file.
If you want to specify your starting path you can define it by adding the --path to the command
php artisan dd:scanner --path=C:\laragon\www\weekreed\app\Services
If you wish the scanner to tranverse just the top level without scanning the sub-directories you should add the --t flag
php artisan dd:scanner --path=C:\laragon\www\weekreed\app\Http --t
You wish to have more control over the recursive level you should make use of the --rl option
php artisan dd:scanner --path=C:\laragon\www\weekreed\app\Http --rl=2
The scanner will stop at the level 2 sub folder NOTE: rl means recursive level, it's not advisable to use --t and --rl= together
Because a typical laravel project can contain different file extensions, e.g .php, .blade.php e.t.c. You can specify the type of file you want to scan using the --ext option
php artisan dd:scanner --ext=php --ext=blade.php
NOTE : --ext option can take in multiple values
You would rather have your dd() commented out instead of being deleted, make use of the --comment flag
php artisan dd:scanner --comment
After all the razzmatas, you want to see those files that tested dd positive, you can use the --s flag to show all files that were affected by the scan
php artisan dd:scanner --s
You can view all options and their description using the --help option
php artisan dd:scanner --help
NOTE
Having dd() in your providers might halt the command, due to the fact that laravel boots your providers when starting the application.
If you are not a fan packages like me you can look up on my webspace where I talked about the alternatives you can consider
Authors
License
🚀 About Me
You can catch me goofing around on my webspace www.weekreed.com
Acknowledgements
salamikola/laravel-ddscanner 适用场景与选型建议
salamikola/laravel-ddscanner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.02k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 salamikola/laravel-ddscanner 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 salamikola/laravel-ddscanner 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-24