承接 umangunagar/laravel-code-formatter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

umangunagar/laravel-code-formatter

最新稳定版本:v1.0.0

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.

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-28