maslosoft/hedron
Composer 安装命令:
composer require maslosoft/hedron
包简介
PHP source code class header applier
README 文档
README
Maslosoft Hedron
PHP source code class header applier
Quick Install
composer require maslosoft/hedron
Documentation
Keeping class headers consitent
When developing projects, we ofter require that file containing PHP class should have some predefined comment header. This might include package information, licensing, homepage address etc.
Apply all at once
This tools provides facility to modify class headers in entire project in a safe way - using PHP Tokenizer, so that it will only modify file if it's 100% safe to change it.
Hedron helps you make your class headers up to date and consistent. It will apply predefined header to all files containing namespaced class definitions.
Instalation
composer require maslosoft/hedron --dev
Usage
Preview list of files to apply headers
vendor/bin/hedron preview
Display rendered template
vendor/bin/hedron show
Apply header to all class files.
Backup/commit your project before continue. This will write headers to files.
vendor/bin/hedron commit
Configuration
Configuration can be provided in yaml file .hedron.yml in root of your project.
Hedron also uses composer.json to make your config easier, or even unnessesary.
Here is how config might look like with example values (see .hedron.example.yml):
# All paths are realtive to your project root
# Root path or paths with sources. If blank will use composer.autoload paths.
sources: ""
# Path to template file, if blank will use vendor/maslosoft/hedron/templates/default.html (no it's not html)
template: ""
# Filter configuration, by default empty. Below is some example filter.
filter:
whitelist:
include:
- app/*
exclude:
- app/cache/*
blacklist:
include:
- app/controllers/*
exclude:
- app/cache/CacheProvider.php
# Reserved
# This contains composer.json as array
composer: ""
tmp: ""
All of this configuration is available in template.
Template
Template uses handlebars as templating engine. It contains all data from .hedron.yml and composer.json.
Here is example, default template:
This software package is licensed under {{composer.license}} license.
@package {{composer.name}}
@licence {{composer.license}}
{{#each composer.authors}}
@copyright Copyright (c) {{name}} <{{email}}>
{{/each}}
{{#if composer.homepage}}@link {{composer.homepage}}{{/if}}
And after rendering it looks like that:
/**
* This software package is licensed under New BSD license.
*
* @package maslosoft/hedron
* @licence New BSD
*
* @copyright Copyright (c) Peter Maselkowski <pmaselkowski@gmail.com>
*
* @link http://maslosoft.com/hedron/
*/
Replacing
This script modifies source files en masse. For safety and robustness it uses native php tokenizer and replaces everything before namespace token. Only that. If there is no namespace declaration file will not be modified.
Resources
maslosoft/hedron 适用场景与选型建议
maslosoft/hedron 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.73k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 01 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 maslosoft/hedron 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 maslosoft/hedron 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 13
- 依赖项目数: 9
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-only
- 更新时间: 2015-01-06