2017 © Pedro Peláez
 

library formatter

Provides formatters for phone numbers, postal codes, etc.

image

tentwofour/formatter

Provides formatters for phone numbers, postal codes, etc.

  • Monday, March 20, 2017
  • by tentwofour
  • Repository
  • 1 Watchers
  • 0 Stars
  • 88 Installations
  • PHP
  • 2 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Formatter Component

MoneyFormatter

Formats from cents => dollars, and vice-versa. Useful for database storage of monetary values, without needing a decimal column., (*1)

PHP's Type Juggling deals with string arguments, which may lead to unexpected results., (*2)

MoneyFormatter::dollarsToCents(12.00);
// => 1200

MoneyFormatter::dollarsToCents(1200);
// => 12.00

PhoneNumberFormatter

Formats a phone number to a flattened string (eg. no separators of any kind), and back to a human-readable style again., (*3)

Current human-readable formats are N/A style (+%d (%d) %d-%d)., (*4)

Useful for normalizing database stored values and allowing application-varied formatting., (*5)

$f = new PhoneNumberFormatter('+14239170989');

$formatted = $f->format()
// => +1 (423) 917-0989

$f->setPhoneNumber($formatted);
$reverse = $f->reverseFormat();
// => +14239170989

PostalCodeFormatter

Formats a postal code to a flattened representation, and back again. Supports US & Canadian postal codes., (*6)

Useful for normalizing database stored values and allowing application-varied formatting., (*7)

$f = new PostalCodeFormatter('H0H 0H0');

$formatted = $f->format()
// => h0h0h0 

$f->setPostalCode($formatted);
$reverse = $f->reverseFormat();
// => H0H 0H0

The Versions

20/03 2017

dev-master

9999999-dev https://github.com/tentwofour/formatter

Provides formatters for phone numbers, postal codes, etc.

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

The Development Requires

ten24 tentwofour data-transformations

20/03 2017

1.0.1

1.0.1.0 https://github.com/tentwofour/formatter

Provides formatters for phone numbers, postal codes, etc.

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

The Development Requires

ten24 tentwofour data-transformations

08/07 2015

1.0.0

1.0.0.0 https://github.com/tentwofour/formatter

Provides formatters for phone numbers, postal codes, etc.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

ten24 tentwofour data-transformations