dhanikk's avatar

dhanikk started a new conversation+100 XP

3d ago

πŸš€ DBStan Update: Static Analysis + Schema Checks for Laravel

Hi everyone πŸ‘‹

I wanted to share an update on DBStan, a package focused on improving the reliability and quality of database interactions in Laravel applications.


πŸ” The Problem

Even with Laravel, it’s still easy to:

  • Write inefficient queries
  • Miss issues before runtime
  • Lack visibility into database structure

πŸ’‘ The Solution

DBStan brings static analysis for database queries + schema insights, similar to what Larastan does for code quality.


βš™οΈ What’s New (Enhancements)

DBStan now includes 9 schema checks to catch silent database issues early:

1. Storage Engine Check

users  β†’ InnoDB  
orders β†’ MyISAM ❌

2. Charset & Collation Issues

utf8 vs utf8mb4 ❌

3. Auto-Increment Limit Risk

INT nearing max ⚠️

4. Low-Cardinality Index Detection

INDEX(status) ❌

5. Composite Index Suggestions

WHERE user_id = 10 AND status = 'paid'
β†’ INDEX(user_id, status)

6. Database Size Monitoring

7. Large Table Detection

orders = 80% of DB ❌

8. Missing Primary Key Check

CREATE TABLE logs (
  message TEXT
); ❌

9. Smart Data Type Detection

  • price β†’ DECIMAL
  • created_at β†’ DATETIME

πŸ› οΈ Installation

composer require itpathsolutions/dbstan

▢️ Demo

https://www.youtube.com/watch?v=Xv5m10R3wmc


πŸ‘‰ Update: DBStan reached 1,000+ downloads shortly after release. Really appreciate the community support!

🎯 Goal

Help Laravel developers catch database issues early, improve schema quality, and avoid production surprises.

dhanikk's avatar

dhanikk wrote a reply+100 XP

3w ago

Thanks a lot, really appreciate the feedback! πŸ™Œ Right now, the package is primarily focused on analyzing the database structure and raw SQL queries to ensure correctness and consistency. Static analysis for complex Eloquent relationships (like nested relations, polymorphic relations, and dynamic scopes) is still a work in progress.

If you have any specific use cases or edge cases in mind, I’d love to hear themβ€”it would really help shape the next improvements!

dhanikk's avatar

dhanikk started a new conversation+100 XP

3w ago

Hi everyone πŸ‘‹

I’d like to share a package I’ve been working on called DBStan, designed to improve the reliability and quality of database interactions in Laravel applications.

πŸ” Problem

While Laravel provides excellent tools for working with databases, it’s still easy to:

Write inefficient or problematic queries

Miss potential issues before runtime

Lack visibility into query structure during development

πŸ’‘ Solution

DBStan aims to bring static analysis for database queries, similar to what Larastan does for code quality.

βš™οΈ What DBStan Does

Analyzes database queries in your Laravel application

Helps detect potential issues early

Encourages better query practices

Improves overall application performance and stability

πŸ› οΈ Installation

composer require itpathsolutions/dbstan

Demo Video https://www.youtube.com/watch?v=Xv5m10R3wmc

🎯 Goal

The goal of this package is to help Laravel developers catch database-related issues early in the development cycle and promote best practices.

I’d really appreciate any feedback, suggestions, or contributions from the community πŸ™Œ

Thanks!