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

Sql Query Formatter Laravel Package

nilportugues/sql-query-formatter

Lightweight PHP SQL formatter that turns messy, computer-generated queries into clean, human-readable plain text. Preserves data-binding placeholders like :variable and ? while reformatting, making SQL easier to read and debug without adding colors or markup.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Legacy System Compatibility: Justifies adoption for teams maintaining PHP 5.5+ applications (e.g., older Laravel versions like 5.2–5.5) where upgrading dependencies is costly or risky. The downgrade to PHPUnit 4.* aligns with legacy stack constraints.
  • Cost Optimization: Reinforces the "build vs. buy" case for teams avoiding modern SQL tools due to dependency bloat (e.g., PHP 8+ projects where this package’s PHP 5.5 support is irrelevant but its lightweight nature is still valuable).
  • Internal Tooling Roadmap: Validates use in monorepos where some services run on older PHP versions, requiring a single SQL formatter that works across the stack.
  • Use Cases (Updated):
    • Legacy Debugging: Format SQL in old Laravel apps (e.g., pre-5.5) where modern tools lack support.
    • CI/CD for Mixed Stacks: Enforce SQL readability in polyglot PHP environments (e.g., PHP 5.6 + PHP 8 services).
    • Third-Party Plugin Integration: Use in custom Laravel packages targeting older PHP versions (e.g., plugins for Laravel 5.1).

When to Consider This Package

  • Adopt if:
    • Your project requires PHP 5.5–7.4 support (e.g., legacy Laravel, custom PHP apps) and cannot upgrade dependencies.
    • You need a zero-dependency tool for one-off SQL formatting in constrained environments (e.g., shared hosting, Docker containers with minimal PHP).
    • Your team prioritizes simplicity over features (e.g., no need for PostgreSQL window functions, just basic indentation).
  • Look elsewhere if:
    • You’re on PHP 8.0+ and can use modern alternatives (e.g., shiny/sql-formatter, which supports PHP 8+ and modern SQL).
    • You need active maintenance (this package’s PHP 5.5 support is a temporary stopgap; the maintainer plans to drop it soon).
    • Your use case involves advanced SQL dialects (e.g., Snowflake, BigQuery) or real-time formatting (e.g., VS Code extensions).
    • Compliance/audits require up-to-date dependencies (PHPUnit 4.* is EOL since 2018).

How to Pitch It (Stakeholders)

For Executives: "This update lets us use this SQL formatter in legacy PHP 5.5+ apps without blocking upgrades elsewhere. For teams maintaining older Laravel versions (e.g., 5.2–5.5), it’s a free, self-hosted way to improve debugging—cutting incident resolution time by formatting unreadable SQL logs. The tradeoff? We’re stuck with a 2015-era tool until we migrate off PHP 5.5. Recommend adopting it only for legacy systems and planning a replacement (e.g., shiny/sql-formatter) for new projects."

For Engineering: *"PHP 5.5+ support confirmed—this works for:

  • Legacy Laravel apps (e.g., 5.1–5.5) where modern tools fail.
  • CI checks in mixed-PHP repos (e.g., PHP 5.6 + PHP 8 services).
  • Quick scripts where you can’t add new dependencies. But: PHPUnit 4.* is EOL, and PHP 5.5 support is temporary. If you’re on PHP 7.4+, consider shiny/sql-formatter instead. For now, this is a stopgap for old stacks—not a long-term solution."*

For Developers: *"Need to format SQL in PHP 5.5–7.4? This still works:

$formatter = new \SQLFormatter\SQLFormatter;
$prettySql = $formatter->format('SELECT * FROM users WHERE id IN (1,2,3)');
// Outputs formatted SQL

But:

  • ⚠️ PHP 8.0+? Use shiny/sql-formatter instead.
  • ⚠️ Legacy only: PHP 5.5 support is going away soon. Use case: Debugging old Laravel apps, CI checks for mixed PHP versions. Install with composer require sql-formatter/sql-formatter:^1.2 (but plan to migrate)."

Key Change: Added PHP version constraints and urgency to migrate due to PHP 5.5 deprecation. Highlighted as a legacy-only tool with a clear upgrade path.

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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky