shawnveltman/texthelpers

A short collection of text helpers that dont yet exist in the Laravel string helpers

Downloads

614

Stars

0

Version

This is my package texthelpers

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

composer require shawnveltman/texthelpers

Usage

use \Shawnveltman\Texthelpers\TextTrait;

Methods

This package contains a trait with the following functions:

stripEverythingButNumbersAndPeriods

stripEverythingButNumbers

money_from_cents
Takes in a string or integer with no decimal point (12345), and returns it formatted as a dollar string ($123.45) 

money_from_dollars
Takes in a string or integer with a decimal point (123.45), and returns it formatted as a dollar string ($123.45)

format_phone_number
Formats a 10 digit phone number as (xxx) xxx-xxxx (also strips leading 1s)

get_twilio_formatted_number
Adds a +1 to a 10 digit phone number (+1xxxxxxxxxx)

get_ten_digit_phone_number

format_postal_code
Splits a 6 digit string into 2 3 digit components (A1B 2C3)

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

shawnveltman

Author

shawnveltman