fyre/inflector
Composer 安装命令:
composer require fyre/inflector
包简介
An inflection library.
README 文档
README
FyreInflector is a free, open-source inflection library for PHP.
Table Of Contents
Installation
Using Composer
composer require fyre/inflector
In PHP:
use Fyre\Utility\Inflector;
Basic Usage
$inflector = new Inflector();
Methods
Camelize
Convert a delimited string into CamelCase.
$stringis the input string.$delimiteris a string representing the delimiter, and will default to "_".
$camelized = $inflector->camelize($string, $delimiter);
Classify
Convert a table_name to a singular ClassName.
$tableNameis a string representing the table name.
$className = $inflector->classify($tableName);
Dasherize
Convert a string into kebab-case.
$stringis the input string.
$dasherized = $inflector->dasherize($string);
Humanize
Convert a delimited string into Human Readable Form.
$stringis the input string.$delimiteris a string representing the delimiter, and will default to "_".
$title = $inflector->humanize($string, $delimiter);
Pluralize
Get the plural form of a word.
$stringis the input string.
$plural = $inflector->pluralize($string);
Rules
Add inflection rules.
$typeis a string representing the inflection type, and must be one of either "plural", "singular", "irregular" or "uncountable".$rulesis an array containing the rules to add.
$inflector->rules($type, $rules);
Singularize
Get the singular form of a word.
$stringis the input string.
$singular = $inflector->singularize($string);
Tableize
Convert a ClassName to a pluralized table_name.
$classNameis a string representing the class name.
$tableName = $inflector->tableize($className);
Underscore
Convert a string into snake_case.
$stringis the input string.
$underscored = $inflector->underscore($string);
Variable
Convert a delimited string into camelBack.
$stringis the input string.
$variable = $inflector->variable($string);
统计信息
- 总下载量: 259
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-22