bolt/codingstyle
Composer 安装命令:
composer require bolt/codingstyle
包简介
Coding style for Bolt projects
README 文档
README
PHP
Bolt tries to adhere a coding style based on PSR-2 and the Symfony2 coding standard.
CodeSniffer
To use run:
composer require bolt/codingstyle squizlabs/php_codesniffer escapestudios/symfony2-coding-standard:^3.0@dev --dev
Add a global before require if you want to install it globally.
If installing globally you also need to configure the installed_paths:
phpcs --config-set installed_paths "$(composer config --global data-dir)"
Then create a CodeSniffer config file named phpcs.xml.dist in your project root:
<?xml version="1.0"?> <ruleset> <!-- Add color to output...umm duh --> <arg name="colors"/> <!-- Files or folders to sniff --> <file>src</file> <file>tests</file> <!-- Path to our coding standard folder --> <rule ref="vendor/bolt/codingstyle/Bolt"/> </ruleset>
Additional changes can be made here. See CodeSniffer's annotated ruleset for more information.
phpcs.xml.dist should be committed for all developers to use.
An phpcs.xml file can also be create which takes precedence over phpcs.xml.dist for local
changes. This file should be ignored from git.
Code Fixer
To use run:
composer require bolt/codingstyle friendsofphp/php-cs-fixer --dev
Add a global before require if you want to install it globally.
Then create a config file named .php_cs.dist in your project root:
<?php return Bolt\CsFixer\Config::create() // addRules() accepts arrays and traversable objects. ->addRules( // Create Bolt's standard rules. Bolt\CsFixer\Rules::create() // Enable risky rules. ->risky() // Enable PHP 5.6, 7.0, and 7.1 rules. Methods exist for each version. //->php71() ) // Modify existing rules or add new ones. ->addRules([ 'heredoc_to_nowdoc' => false, 'mb_str_functions' => true, ]) // Add directories to scan. ->in('src', 'tests') ;
See their website for a list of rules and additional configuration options.
.php_cs.dist should be committed for all developers to use.
An .php_cs file can also be create which takes precedence over .php_cs.dist for local
changes. This file should be ignored from git.
JavaScript
There's no explicitly written style yet, but when creating the files needed for Bolt using the grunt toolchain there's a target linting the javascript code.
bolt/codingstyle 适用场景与选型建议
bolt/codingstyle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 62.08k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bolt/codingstyle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bolt/codingstyle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 62.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 6
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-11