Download the PHP package umangunagar/laravel-code-formatter without Composer
On this page you can find all versions of the php package umangunagar/laravel-code-formatter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download umangunagar/laravel-code-formatter
More information about umangunagar/laravel-code-formatter
Files in umangunagar/laravel-code-formatter
Package laravel-code-formatter
Short Description A simple package to format PHP & Blade files in a Laravel project using Prettier
License MIT
Informations about the package laravel-code-formatter
Laravel Code Formatter
A Laravel package for formatting Blade, Controller, and Model files using a custom JSON-based formatting configuration.
📌 Installation
You can install the package via Composer:
Install Dependencies
After installing the package, run the following command to install the required dependencies:
This package includes a default formatting configuration file (formatter.json). If you want to customize it, publish the configuration manually:
This will create a formatter.json file in your project's root directory, allowing you to define custom formatting rules.
⚡ Usage
This package provides Artisan commands to format specific Laravel files efficiently.
📂 Format Controllers
To format all controller files inside app/Http/Controllers:
To format a specific controller:
To format all controllers inside a subdirectory:
📂 Format Models
To format all model files inside app/Models:
To format a specific model:
To format all models inside a subdirectory:
📂 Format Blade Files
To format all Blade files inside resources/views:
To format a specific Blade file:
To format all Blade files inside a subdirectory:
💡 Why Use This Package?
✔ Custom Formatting Rules: This package allows you to define your own formatting rules in formatter.json.
✔ Targeted Formatting: Easily format specific directories, files, or subdirectories without manually specifying paths.
✔ Laravel-Friendly: Provides structured Artisan commands for seamless integration into Laravel projects.
🛠 Troubleshooting
If you encounter any issues, try the following:
-
Ensure the package is installed correctly:
-
If formatting commands are not recognized, clear the autoload cache:
- Ensure you have published the configuration if needed:
📜 License
This package is open-source and available under the MIT License.