Weave 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

Dindent Laravel Package

schleuse/dindent

Dindent is a regex-based HTML beautifier for PHP that indents markup from template engines without rebuilding, sanitizing, or otherwise altering the document—unlike DOM or Tidy. Ideal for debugging messy output. Install via Composer: schleuse/dindent.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Developer Productivity: Expanded HTML formatting capabilities (e.g., <style> tag support, one-line mode) reduce manual formatting overhead for complex templates (e.g., emails with embedded CSS or inline scripts). Multi-line comment handling and optimized speed further streamline debugging workflows. The v3.1.0 fix resetting temporary replacements between calls means a single formatter instance can be reused safely across a file, a test suite, or a long-running worker without output drifting from prior inputs.
  • Automated Testing: New features like one-line mode and <pre|textarea> extraction enable precise HTML diffing for edge cases (e.g., minified snippets or code blocks), improving test reliability for dynamic content. The between-call state reset removes a class of order-dependent flakiness — the Nth assertion in a suite now produces the same output as the first, which matters when golden-file comparisons run in loops or data providers.
  • Build vs. Buy: The PHP 8.2 requirement (breaking change) justifies adoption for teams already upgrading to modern PHP versions, avoiding custom solutions for HTML normalization. The package’s specialization (no frontend framework overlap) strengthens the "buy" case, and the fast follow-up patch cadence signals active maintenance — a key input when buying a small utility rather than owning one.
  • Roadmap Priorities:
    • Frontend Tooling: One-line mode and <style> support align with initiatives to standardize HTML output in CI/CD for performance-critical templates (e.g., marketing emails).
    • QA Automation: Multi-line comment handling, speed optimizations, and the stateless-between-calls guarantee (v3.1.0) reduce flaky tests in regression suites for HTML-heavy features, including suites that format hundreds of fixtures in one process.
    • Developer Experience: Breaking change (PHP 8.2) is offset by zero-config usability and no runtime overhead, reinforcing its role as a lightweight dev tool. Patch releases that fix correctness without API churn are low-cost upgrades — no migration work, no code review burden.

When to Consider This Package

  • Adopt if:
    • Your team uses PHP 8.2+ and debugs/test HTML with embedded CSS, inline scripts, or code blocks (e.g., <pre>, <textarea>).
    • You need one-line HTML formatting for minified snippets or diff-friendly comparisons in tests.
    • Inconsistent HTML indentation causes flaky tests or manual review bottlenecks in Laravel/Blade workflows.
    • You format many documents in a single process (test suites with data providers, queue workers, Octane-style long-lived workers) and need each call to be independent of the last.
    • You lack a dedicated frontend tool (e.g., Prettier) and want a PHP-native solution.
  • Look elsewhere if:
    • You’re on PHP < 8.2 (requires upgrade; no downgrade path).
    • Your HTML is primarily generated by JS frameworks (React/Vue) where ESLint/Prettier is preferred.
    • You prioritize runtime performance over dev-time formatting (this is a build-time tool).
    • You use a broader HTML linter (e.g., PHP_CSS_Validator) that already handles indentation + validation.

How to Pitch It (Stakeholders)

For Executives: *"This v3.1.0 patch hardens schleuse/dindent as the Swiss Army knife for HTML formatting—<style> tags, one-line snippets, and code blocks are already covered, and this release removes a state-leak bug so repeated formatting in one process stays consistent. For teams on PHP 8.2+, it’s a zero-cost upgrade that:

  • Saves QA time by standardizing complex HTML (emails, reports) in CI.
  • Reduces PR noise with precise diffs for dynamic content.
  • Future-proofs your stack by aligning with PHP 8.2’s EOL timeline. ROI: 10-minute setup for 80% cleaner HTML output—a no-brainer for dev-heavy teams. The v3.1.0 patch is a drop-in bump with no migration cost."*

For Engineering: *"v3.1.0 is a correctness patch, not a feature release:

  • Temporary replacements now reset between calls — no cross-call contamination when you reuse the formatter across a test suite, queue worker, or long-lived process.
  • No API changes, no new config — upgrade from v3.0.0 is a version bump. Still requires PHP 8.2+.

Usage (unchanged from v3.0.0):

// Format with one-line mode for minified diffs
$minified = Dindent::format($html, mode: 'one-line');

// Handle <style> + preserve <pre> blocks
$formatted = Dindent::format($emailTemplate);
assertStringEqualsFile('expected.html', $formatted);

Alternatives (e.g., custom scripts) add maintenance overhead—this does one thing, perfectly, now handles 90% of real-world HTML cases, and no longer carries hidden state between invocations. Pin to ^3.1 to pick up the fix."*

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.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource