tbondois/php-debug 问题修复 & 功能扩展

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

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

tbondois/php-debug

Composer 安装命令:

composer require tbondois/php-debug

包简介

PHP debug libraries (dumpers...) for common needs. should not be installed in production or use IP restriction feature.

README 文档

README

Presentation

This project is based on Kint and VarDumper. I added some features like IP restrictions.

Installation in a project

composer require tbondois/php-debug --dev

Update it in a project

composer update tbondois/php-debug

Usage

Inclusion and basic usage

include_once 'vendor/autoload.php';

debug_print_rich("Kint rich print alias !");
debug_print_simple("Kint simple print alias !");
debug_print_console("Kint browser-console log alias");
debug_print_content("Symfony-VarDumper alias !");
$dump = debug_print_return("Kint return alias");

debug_die_rich("Rich-print and kill script");
debug_die_simple("Simple-print and kill script");
debug_die_console("JS console and kill script");
debug_die_content("Symfony-VarDumper print and kill script");

Access Control (Recommended for Production environments)

Disable debug functions in the environment

To ensure this functions will be skipped, define manually in your $_ENV a specific variable.

  • In Symfony or Laravel or project using symfony/dotenv, add this to you .env file :
TB_DEBUG_BLOCK_MODE = 1
  • Or use the native PHP command :
putenv("TB_DEBUG_BLOCK_MODE=1");
  • Or using this library helpers :
\debug_access::setEnvBlockMode(debug_access::MOD_BLOCK_WEB_WHITELIST);

Disable debug feature in the environment except for some people :

If you want the features being executed for specific IP, add :

  • In your .env file ;
TB_DEBUG_BLOCK_MODE=1
TB_DEBUG_WHITELIST_ADDRS=<IP ADDRESSES>
  • Or in PHP using native functions :
putenv("TB_DEBUG_BLOCK_MODE=1");
putenv("TB_DEBUG_WHITELIST_ADDRS=<IP ADDRESSES>");
  • Or using this library helpers :
\debug_access::setEnvBlockMode(\debug_access::MOD_BLOCK_WEB_WHITELIST);
\debug_access::setEnvWhitelistAddrs("<IP ADDRESSES>");

You obviously have to replace <IP ADDRESSES> by one or more IP addresses separated by comas (,). It will be compared by the one in $_SERVER["REMOTE_ADDR"].

The Blocking Modes :

Suivant la valeur de TB_DEBUG_BLOCK_MODE :

  • 0 : Blocked nowhere for nobody.
  • 1 : Block web for addresses not whitelisted.
  • 2 : Blocked in web for everybody
  • 4 : Blocked in local terminal
  • 5 : (2+1) Blocked in local terminal AND web for addresses not whitelisted.
  • 6 : (4 + 2) Blocked everywhere for everybody.

References

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固