pfrug/laravel-debug-helpers
Composer 安装命令:
composer require pfrug/laravel-debug-helpers
包简介
Useful debugging helpers for Laravel development
README 文档
README
A small set of developer utilities for Laravel. These helpers provide debugging functions that should probably exist in Laravel by default.
Features
Dump helpers
d(...$vars)
Like dump(), but does not stop execution.
dt(...$vars)
Like dump(), but if the variable is arrayable (e.g. Eloquent models), it converts it to array before dumping.
ddt(...$vars)
Same as dt(), but dies after dumping.
You can use these in place of dump() and dd() when working with Eloquent models or arrays.
SqlHelper
SqlHelper::sqlFromBindings($query, $print = true)
Combines toSql() and getBindings() on a query builder or Eloquent builder to output the full SQL string with all bindings inlined.
This is useful for debugging complex queries.
use LaravelDebugHelpers\SqlHelper; // Complex query with joins and subqueries $query = User::join('profiles', 'users.id', '=', 'profiles.user_id') ->leftJoin('organizations', 'users.organization_id', '=', 'organizations.id') ->whereHas('roles', function($q) { $q->whereIn('name', ['admin', 'moderator']); }) ->where('users.status', 'active') ->where('users.email_verified_at', '!=', null) ->where(function($q) { $q->where('profiles.is_public', 1) ->orWhere('users.account_type', 'premium'); }) ->where('organizations.country', 'US') ->where('users.created_at', '>=', now()->subMonths(6)) ->select('users.id', 'users.name', 'users.email', 'profiles.bio', 'organizations.name as org_name') ->orderBy('users.created_at', 'desc') ->limit(25); SqlHelper::sqlFromBindings($query);
Output:
SELECT `users`.`id`, `users`.`name`, `users`.`email`, `profiles`.`bio`, `organizations`.`name` AS `org_name` FROM `users` INNER JOIN `profiles` ON `users`.`id` = `profiles`.`user_id` LEFT JOIN `organizations` ON `users`.`organization_id` = `organizations`.`id` WHERE EXISTS ( SELECT * FROM `roles` INNER JOIN `user_roles` ON `roles`.`id` = `user_roles`.`role_id` WHERE `users`.`id` = `user_roles`.`user_id` AND `name` IN ('admin', 'moderator') ) AND `users`.`status` = 'active' AND `users`.`email_verified_at` IS NOT NULL AND ( `profiles`.`is_public` = 1 OR `users`.`account_type` = 'premium' ) AND `organizations`.`country` = 'US' AND `users`.`created_at` >= '2025-04-01 14:26:52' ORDER BY `users`.`created_at` desc
If $print is false, it returns the SQL string instead of printing and stopping.
Installation
Install via composer:
composer require pfrug/laravel-debug-helpers
If package auto-discovery is disabled, register the service provider manually in config/app.php:
'providers' => [ LaravelDebugHelpers\DevUtilsServiceProvider::class, ],
Disclaimer
These utilities are intended for development only. Do not leave ddt() or raw SQL dump calls in production environments.
pfrug/laravel-debug-helpers 适用场景与选型建议
pfrug/laravel-debug-helpers 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 745 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「debug」 「helpers」 「development」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pfrug/laravel-debug-helpers 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pfrug/laravel-debug-helpers 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pfrug/laravel-debug-helpers 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Debug your SimpleBus EventBus and CommandBus
nice output for debug functions for PHP 5.3
Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.
Library with classes to help you do batch.
Analysis module for finding problematical shop data.
Twig extensions for Tracy Debugger
统计信息
- 总下载量: 745
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-16