2017 © Pedro Peláez
 

library php-inflector

PHP Inflector, ported from Rails

image

koenpunt/php-inflector

PHP Inflector, ported from Rails

  • Monday, May 21, 2018
  • by koenpunt
  • Repository
  • 2 Watchers
  • 9 Stars
  • 21,946 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

PHP Inflector Build Status

PHP Inflector Library, ported from Rails, (*1)

Minimum Requirements

Installation

The easiest way to use PHP Inflector is by installing it with Composer, (*2)

Create or update composer.json:, (*3)

{
  "require": {
    "koenpunt/php-inflector": "1.0.*"
  }
}

And run composer install, (*4)

Features

  • Basics:, (*5)

    • singularize
    • pluralize
    • singularize
    • camelize
    • underscore
    • humanize
    • titleize
    • tableize
    • classify
    • dasherize
    • denamespace
    • foreign_key
    • ordinalize
  • Internationalization, (*6)

    • transliterate
    • parameterize

Usage

PHP Inflector is implemented as class with static functions, (*7)

Inflector::underscore("PhpInflector\Inflector"); # => php_inflector/inflector

PhpInflector\Inflector::parameterize("Ærøskøbing on Water"); # => aeroskobing-on-water

PhpInflector\Inflector::foreign_key("Admin\Post"); # => post_id

PhpInflector\Inflector::denamespace("PhpInflector\Inflector\Inflections"); # => Inflections

PhpInflector\Inflector::dasherize("puni_puni"); # => puni-puni

It is also possible to add custom inflections, like acronyms:, (*8)

PhpInflector\Inflector::inflections(function($inflect){
  $inflect->acronym('RESTful');
});

PhpInflector\Inflector::titleize('RESTfulController'); # => RESTful Controller

More examples and documentation can be found in the source., (*9)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

The Versions

21/05 2018

dev-master

9999999-dev

PHP Inflector, ported from Rails

  Sources   Download

MIT

php inflector

11/04 2014

dev-php-5.3

dev-php-5.3

PHP Inflector, ported from Rails

  Sources   Download

MIT

php inflector

10/04 2014

v1.0.0

1.0.0.0

PHP Inflector, ported from Rails

  Sources   Download

MIT

php inflector