Helps to convert PHP data into human readable information. Dates, strings, file sizes, pluralization, arrays, ordinals, number formatting, etc.
Converts an integer to a string containing commas every three digits.
Converts a large integer to a friendly text representation.
Return AP (Associated Press) formatted numbers, use words for numbers less than 10.
Return humanized date for yesterday, today, and tomorrow, else return date.
Get yesterdays date
Get tomorrows date
Get todays date
Converts an integer to its ordinal as a string.
Formats a number to a human-readable number.
Converts an integer into a compact representation.
Bounds a value from above.
Interprets numbers as occurrences. Also accepts an optional array/map of overrides.
Returns the plural version of a given word if the value is not 1. The default suffix is 's'.
Matches a pace (value and interval) with a logical time frame.
Formats the value like a 'human-readable' file size (i.e. '13 KB', '4.1 MB', '102 bytes', etc).
Truncates a string if it is longer than the specified number of characters. Truncated strings will end with a translatable ellipsis sequence ("…").
Truncates a string after a certain number of words.
Conversion of <br/> tags to newlines.
Capitalizes the first letter in a string, optionally lowercase the tail.
Captializes the first letter of every word in a string.
Intelligently capitalizes eligible words in a string and normalizes internal whitespace.
Normalizes internal whitespace.
Converts a list of items to a human readable string with an optional limit.
Describes how many times an action item appears in a list.
Check if a date is on the weekend.
Check if a date is a weekday, utilizes the isWeekend function.
- Inspiration from HubSpot Humanize
PHP Humanize is open-sourced software licensed under the MIT license