marekmiklusek/auditor

A package that provides auditing for: dd(), dump(), // FIXME:, // TODO:, and more...

v0.1.0 2025-06-07 15:44 UTC

This package is auto-updated.

Last update: 2025-06-08 16:00:26 UTC


README

logo for my php package called_ auditor(1)

๐Ÿ” Laravel Auditor

CI Pipeline Latest Stable Version Downloads License

A Laravel package that helps you audit your codebase for debugging statements and task-related comments that should not make it to production, such as:

  • ๐Ÿ’ฅ dd() debug statements
  • ๐Ÿ”ฎ dump() debug statements
  • โœ… // TODO: comments
  • ๐Ÿ› ๏ธ // FIXME: comments

๐Ÿ“‹ Requirements

  • PHP 8.3 or higher
  • Laravel 12.17 or higher

๐Ÿ“ฅ Installation

You can install the package via Composer:

composer require marekmiklusek/auditor --dev

๐Ÿš€ Usage

๐Ÿ” Audit Your Code

Run the following command to scan your codebase for debugging statements and task-related comments:

php artisan audit:code

This will scan the following directories for PHP and Blade files:

  • ๐Ÿ“ app
  • ๐Ÿ“ config
  • ๐Ÿ“ database
  • ๐Ÿ“ resources
  • ๐Ÿ“ routes
  • ๐Ÿ“ tests

The command will display a list of all found issues with their file paths, line numbers, and content.

๐Ÿ”ง Fixing Issues

You can automatically remove the detected issues using the --fix option:

# Remove all detected issues
php artisan audit:code --fix=all

# Remove only dd() statements
php artisan audit:code --fix=dd

# Remove only dump() statements
php artisan audit:code --fix=dump

# Remove only TODO comments
php artisan audit:code --fix=todo

# Remove only FIXME comments
php artisan audit:code --fix=fixme

๐Ÿ“Š Example Output

When running the audit command, you'll see output similar to this:

๐Ÿ” Auditing codebase...

app/Http/Controllers/UserController.php (Line 25): dd($user);
app/Models/Post.php (Line 47): // TODO: Add validation
resources/views/welcome.blade.php (Line 15): {{ dump($data) }}

โ— Found 3 issue(s). Run with --fix=all to remove them all.

After fixing:

๐Ÿ” Auditing codebase...

๐Ÿ”ง Fixed: app/Http/Controllers/UserController.php
๐Ÿ”ง Fixed: app/Models/Post.php
๐Ÿ”ง Fixed: resources/views/welcome.blade.php

๐Ÿ”ง Fixed 3 issue(s).

๐Ÿ’ก Why Use This Package?

  • ๐Ÿ›ก๏ธ Code Quality: Prevent debugging code from accidentally being deployed to production
  • ๐Ÿ“ Task-Related comments: Keep track of TODOs and FIXMEs comments in your codebase
  • ๐Ÿšฆ Pre-Deployment Check: Run as part of your CI/CD pipeline to ensure clean code
  • ๐Ÿงน Simple Cleanup: Easily remove all debugging statements with a single command

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

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