Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use Inflector in CakePHP3

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 547
    Comment on it

    Hello Reader's ,
    Hope you are doing good today.

    Today in my blog, I am going to explain about the inflector in CakePHP3.
    inflector is a many utility classes which takes a string and can manipulate it to handle word variations.

    Example: inflector::pluralize('example')

    Here is short overview of the Inflector classes methods and there uses.

    1) pluralize

    // Apples
    Inflector::pluralize('Apple');

    2) singularize

    // Person
    Inflector::singularize('People');

    3) camelize

    // ApplePie
    Inflector::camelize('Apple_pie')

     

    4) underscore

    // apple_pie
    Inflector::underscore('ApplePie');

    5) humanize

    // apple_pie
    Inflector::humanize('apple_pie');

    6) classify

    // UserProfileSetting
    Inflector::classify('user_profile_settings');

    7) dasherize

    // user-profile-setting
    Inflector::dasherize('UserProfileSetting');

    8) tableize

    // user_profile_settings
    Inflector::tableize('UserProfileSetting');

    9) variable

    // applePie	
    Inflector::variable('apple_pie');

    10) slug

    // apple-puree
    Inflector::slug('apple pure');

    Demo Example :- http://inflector.cakephp.org/

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: