kevinkaske/pluralize

A simple PHP lib to turn words into their plural form

dev-master 2019-03-22 15:50 UTC

This package is auto-updated.

Last update: 2024-05-23 02:52:11 UTC


README

A simple PHP lib to turn words into their plural form. Based on the rules from Rails pluralize.

Install via composer

Installation of pluralize is through composer.

To get started quickly, run the following command

composer require kevinkaske/pluralize

Usage

pluralize(single_string,number_int);

Example 1:

$balloon_number = 1;

echo 'You have '.$balloon_number.' '.pluralize('balloon',$balloon_number).'!';

Would output You have 1 balloon!

Example 2:

$balloon_number = 2;

echo 'You have '.$balloon_number.' '.pluralize('balloon',$balloon_number).'!';

Would output You have 2 balloons!