https://github.com/elusivecodes/fyreinflector
FyreInflector is a free, open-source inflection library for PHP.
https://github.com/elusivecodes/fyreinflector
inflection inflector php
Last synced: 3 months ago
JSON representation
FyreInflector is a free, open-source inflection library for PHP.
- Host: GitHub
- URL: https://github.com/elusivecodes/fyreinflector
- Owner: elusivecodes
- License: mit
- Created: 2021-10-22T11:32:46.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-01T04:07:22.000Z (11 months ago)
- Last Synced: 2024-11-01T05:17:24.652Z (11 months ago)
- Topics: inflection, inflector, php
- Language: PHP
- Homepage:
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FyreInflector
**FyreInflector** is a free, open-source inflection library for *PHP*.
## Table Of Contents
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Methods](#methods)## Installation
**Using Composer**
```
composer require fyre/inflector
```In PHP:
```php
use Fyre\Utility\Inflector;
```## Basic Usage
```php
$inflector = new Inflector();
```## Methods
**Camelize**
Convert a delimited string into CamelCase.
- `$string` is the input string.
- `$delimiter` is a string representing the delimiter, and will default to "*_*".```php
$camelized = $inflector->camelize($string, $delimiter);
```**Classify**
Convert a table_name to a singular ClassName.
- `$tableName` is a string representing the table name.
```php
$className = $inflector->classify($tableName);
```**Dasherize**
Convert a string into kebab-case.
- `$string` is the input string.
```php
$dasherized = $inflector->dasherize($string);
```**Humanize**
Convert a delimited string into Human Readable Form.
- `$string` is the input string.
- `$delimiter` is a string representing the delimiter, and will default to "*_*".```php
$title = $inflector->humanize($string, $delimiter);
```**Pluralize**
Get the plural form of a word.
- `$string` is the input string.
```php
$plural = $inflector->pluralize($string);
```**Rules**
Add inflection rules.
- `$type` is a string representing the inflection type, and must be one of either "*plural*", "*singular*", "*irregular*" or "*uncountable*".
- `$rules` is an array containing the rules to add.```php
$inflector->rules($type, $rules);
```**Singularize**
Get the singular form of a word.
- `$string` is the input string.
```php
$singular = $inflector->singularize($string);
```**Tableize**
Convert a ClassName to a pluralized table_name.
- `$className` is a string representing the class name.
```php
$tableName = $inflector->tableize($className);
```**Underscore**
Convert a string into snake_case.
- `$string` is the input string.
```php
$underscored = $inflector->underscore($string);
```**Variable**
Convert a delimited string into camelBack.
- `$string` is the input string.
```php
$variable = $inflector->variable($string);
```