codeigniter/coding-standard
Composer 安装命令:
composer require --dev codeigniter/coding-standard
包简介
Official Coding Standards for CodeIgniter based on PHP CS Fixer
关键字:
README 文档
README
This library holds the official coding standards of CodeIgniter based on PHP CS Fixer and powered by Nexus CS Config.
Installation
You can add this library as a local, per-project dependency to your project using Composer:
composer require codeigniter/coding-standard
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
composer require --dev codeigniter/coding-standard
Setup
To start, let us create a .php-cs-fixer.dist.php file at the root of your project.
<?php use CodeIgniter\CodingStandard\CodeIgniter4; use Nexus\CsConfig\Factory; return Factory::create(new CodeIgniter4())->forProjects();
This minimal setup will return a default instance of PhpCsFixer\Config containing all rules applicable
for the CodeIgniter organization.
Then, in your terminal, run the following command:
$ vendor/bin/php-cs-fixer fix --verbose
Adding License Headers
The default setup will not configure a license header in files. License headers can be especially useful for library authors to assert copyright. To add license headers in your PHP files, you can simply provide your name and name of library. Optionally, you can also provide your email and starting license year.
<?php use CodeIgniter\CodingStandard\CodeIgniter4; use Nexus\CsConfig\Factory; -return Factory::create(new CodeIgniter4())->forProjects(); +return Factory::create(new CodeIgniter4())->forLibrary( + 'CodeIgniter 4 framework', + 'CodeIgniter Foundation', + 'admin@codeigniter.com', + 2021, +);
Providing Overriding Rules and Options
The list of enabled rules can be found in the CodeIgniter\CodingStandard\CodeIgniter4 class. If you
feel the rule is not applicable to you or you want to modify it, you can do so by providing an array of
overriding rules to the second parameter of Factory::create().
Similarly, you can further modify the PhpCsFixer\Config instance returned by using the available options.
All available options are fully supported by Nexus CS Config and abstracted by simply providing an
array of key-value pairs in the third parameter of Factory::create().
<?php use CodeIgniter\CodingStandard\CodeIgniter4; use Nexus\CsConfig\Factory; -return Factory::create(new CodeIgniter4())->forProjects(); +return Factory::create(new CodeIgniter4(), [], [ + 'usingCache' => false, +])->forProjects();
You can check out this library's own .php-cs-fixer.dist.php for inspiration on how it is done.
For more detailed documentation on all available options, you can check here.
Contributing
All forms of contributions are welcome!
Since the rules here will be propagated and used within the CodeIgniter organization, all proposed rules and modifications to existing rules should have a proof-of-concept (POC) PR sent first to the CodeIgniter4 repository with possible changes to the code styles applied there. Once accepted there, you can send in a PR here to apply those rules.
License
This work is open-sourced under the MIT license.
codeigniter/coding-standard 适用场景与选型建议
codeigniter/coding-standard 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.67M 次下载、GitHub Stars 达 73, 最近一次更新时间为 2021 年 08 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「static analysis」 「phpcs」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codeigniter/coding-standard 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codeigniter/coding-standard 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codeigniter/coding-standard 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
TwigStan is a static analyzer for Twig templates powered by PHPStan
The coding standard applying to all Youdot PHP projects, based on Doctrine set of PHPCS rules, with additional checks.
CodeSniffer ruleset for the ZettaCMS coding standard
Sentiment analysis library for PHP.
Database Standardization and Analysis Tool for Laravel
统计信息
- 总下载量: 1.67M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 76
- 点击次数: 16
- 依赖项目数: 59
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-19