Blade Formatter screenshot

Blade Formatter

Author Avatar Theme by Shufo
Updated: 8 Feb 2025
500 Stars

An opinionated blade template formatter for Laravel that respects readability

Categories

Overview

The blade-formatter is an opinionated blade template formatter for Laravel that aims to provide a formatter for blade templates, as there is no official blade template formatter available. It offers features such as automatic indentation of markup inside directives, automatic spacing for blade templating markers, support for PHP 8 features, PSR-2 support, and automatic Tailwind CSS class sorting.

Features

  • Automatically Indents markup inside directives
  • Automatically add spacing to blade templating markers
  • PHP 8 support (null safe operator, named arguments)
  • PSR-2 support (format inside directives)
  • Automatic Tailwind CSS Class Sorting
  • Custom Directive support

Installation

To install the blade-formatter, you can use yarn or global docker. Here are the installation steps:

  1. Install the package globally using yarn:

    yarn global add blade-formatter
    
  2. Or, install the package using global docker:

    docker pull docker.pkg.github.com/blade-formatter/blade-formatter/blade-formatter:latest
    

Summary

The blade-formatter is an opinionated blade template formatter for Laravel that offers various features to format blade templates. It provides automatic indentation of markup inside directives, adds spacing to blade templating markers, supports PHP 8 features and PSR-2 format inside directives. It also includes the ability to automatically sort Tailwind CSS classes. The blade-formatter can be installed using yarn or global docker.