signifly/php-config

Signifly PHP Config

v1.0.0 2021-05-22 07:41 UTC

This package is auto-updated.

Last update: 2024-09-07 19:33:50 UTC


README

此仓库包含各种服务的默认配置文件。

代码格式化

我们使用 php-cs-fixer 来格式化代码,以便在整个项目中标准化样式。应有一个插件在保存文件时格式化文件,适用于以下最流行的编辑器:VS Code、Sublime Text、PHP Storm

可选地,将以下内容添加到项目 composer.json 文件中的 scripts 部分

"format": [
    "vendor/bin/php-cs-fixer fix"
],

这允许您从终端运行 composer format 来格式化整个代码库。

用法

通过 Composer 拉取安装此包

composer require signifly/php-config --dev

然后更新 .php-cs-fixer.php 文件

$finder = (new PhpCsFixer\Finder)
    ->notPath('bootstrap')
    ->notPath('storage')
    ->notPath('vendor')
    ->notPath('docker')
    ->in(getcwd())
    ->name('*.php')
    ->notName('*.blade.php')
    ->notName('index.php')
    ->notName('server.php')
    ->ignoreDotFiles(true)
    ->ignoreVCS(true);

return Signifly\styles($finder);

请记住根据项目设置更新 Finder