umangunagar/laravel-code-formatter
Composer 安装命令:
composer require umangunagar/laravel-code-formatter
包简介
A simple package to format PHP & Blade files in a Laravel project using Prettier
README 文档
README
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:
composer require umangunagar/laravel-code-formatter
Install Dependencies
After installing the package, run the following command to install the required dependencies:
php artisan install:configuration
This package includes a default formatting configuration file (formatter.json). If you want to customize it, publish the configuration manually:
php artisan vendor:publish --tag=formatter-config
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:
php artisan format:controllers
To format a specific controller:
php artisan format:controllers ExampleController.php
To format all controllers inside a subdirectory:
php artisan format:controllers Example
📂 Format Models
To format all model files inside app/Models:
php artisan format:models
To format a specific model:
php artisan format:models Example.php
To format all models inside a subdirectory:
php artisan format:models Example
📂 Format Blade Files
To format all Blade files inside resources/views:
php artisan format:blades
To format a specific Blade file:
php artisan format:blades example.blade.php
To format all Blade files inside a subdirectory:
php artisan format:blades Example
💡 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:
composer require umangunagar/laravel-code-formatter
-
If formatting commands are not recognized, clear the autoload cache:
composer dump-autoload
-
Ensure you have published the configuration if needed:
php artisan vendor:publish --tag=formatter-config
📜 License
This package is open-source and available under the MIT License.
umangunagar/laravel-code-formatter 适用场景与选型建议
umangunagar/laravel-code-formatter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 umangunagar/laravel-code-formatter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 umangunagar/laravel-code-formatter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-28