Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Kint Laravel Package

raveren/kint

Kint is a powerful, developer-friendly PHP debugging and inspection tool for Laravel. Dump variables with rich, readable output (arrays, objects, stack traces, timing) in the browser or CLI, making it easier to explore data and troubleshoot faster.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install via Composer: composer require --dev raveren/kint
  2. In your code, replace var_dump() or dd() with d($variable) or k($variable)
  3. For global availability, include Kint::dump($var); or ensure autoloading loads vendor/autoload.php (it works out-of-the-box with Composer)
  4. First use: call d($_SERVER) in a script — Kint will render a beautifully formatted, collapsible output with type info, memory usage, and structure — far more readable than native dumps

Implementation Patterns

  • Conditional debugging: Wrap d() calls inside if (env('APP_DEBUG')) or use Kint::$enabled = true/false; to toggle globally
  • Trace execution: Use Kint::trace(); to dump the call stack with arguments and source locations
  • Enhanced dd() replacement: Create ddd() helper: function ddd(...$vars) { Kint::dump(...$vars); die; }
  • Contextual filtering: Use Kint::enabled() with environment checks or custom rules (e.g., only for admin IPs)
  • CLI debugging: Set Kint::$mode = 'cli'; for terminal-friendly output ( ANSI color, tree view without HTML)

Gotchas and Tips

  • Output buffering: Kint injects HTML unless in CLI — avoid conflicts by ensuring no prior output or wrapping calls in ob_start() / ob_get_clean() if needed
  • Theme customization: Use Kint::$theme = 'monokai'; or build custom CSS classes via Kint::$renderer_classes
  • Hidden properties: By default, Kint skips private/protected properties of internal classes — override with Kint::$aliases or Kint::$max_depth
  • Performance: Avoid leaving d() calls in production — Kint adds overhead and may leak sensitive data; use config flags or environment checks
  • Static analysis conflict: Tools like PHPStan may complain about undefined d() — add it to bootstrap.php or define a stub in .phpstorm.meta.php or phpstan.neon
  • Extensibility: Implement Kint\Renderer\RendererInterface to build custom output (e.g., JSON logging) or extend Kint\Parser\Parser for custom object parsing
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation
uri-template/tests