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

Laravel Db Auditor Laravel Package

vcian/laravel-db-auditor

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package as a dev dependency:

composer require --dev vcian/laravel-db-auditor

Publish config:

php artisan vendor:publish --tag=db-auditor

Run the audit once to get immediate insights:

php artisan db:audit

Start with the CLI (db:standard, db:constraint, db:track) before exploring the Web UI at /laravel-db-auditor.

Implementation Patterns

  • Daily Development Hook: Add php artisan db:standard to your local pre-commit hook or CI pipeline to enforce naming standards (e.g., snake_case columns, created_at/updated_at presence).
  • Migration Validation: Before running migrations, run php artisan db:constraint to catch missing indexes or foreign keys before they hit production. Use the interactive prompt to add constraints where safe (MySQL/SQLite only).
  • Team Audits: Run php artisan db:track in PR reviews to see who created/modified tables (via Git author) and ensure schema changes follow agreed conventions.
  • Web Dashboard for Debugging: Use the /laravel-db-auditor UI to visually inspect standard violations (e.g., camelCase fields) and compare tables side-by-side—ideal for onboarding and cross-team alignment.

Gotchas and Tips

  • SQLite Limitations: You cannot add primary/foreign keys to existing tables. Expect no “Add Constraint” option for SQLite—only reporting.
  • PostgreSQL Caveat: Full audit (including standards) works, but adding constraints is not yet supported per v2.2.1.
  • Skip Tables: Add skip_tables in config/db-auditor.php to exclude audit-irrelevant tables (e.g., sessions, migrations).
  • Git Dependency for db:track: To see commit authors, ensure your app lives in a Git repo and DB_DATABASE is set correctly in .env. Falls back to system username if no Git info is found.
  • Typical Pitfall: Missing created_at/updated_at timestamps won’t be flagged unless your project explicitly defines timestamp rules in config/db-auditor.php. Adjust rules.timestamp to enforce your team’s policy.
  • Custom Rules: Extend standards by editing config/db-auditor.php—e.g., enforce INT(10) for IDs or ban text columns without need.
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony