Common types for clean code PHP projects.

v3.0.10 2024-01-16 23:44 UTC

README

Requirements

  • PHP ^8.1

Installation

To install this module, run the following command in your terminal:

composer require agenciaecode/types

Basic usage

$email = Email::from('email@domain.com');
echo $email->getHiddenFormat(); // Output: e***l@d********m

Common methods

Most type have at least the following common methods:

 - public static function from(...$args)
 - public static function tryFrom(...$args)
 - public static function innFrom(...$args)
 - public static function isValid(...$args)
 - public function equals($value)
 - public function getValue(...$args)
 - public function __toString(...$args)

Available Types

  • Address
  • Arr
  • Boolean
  • Byte
  • Centimeter
  • Cnpj
  • Cpf
  • Domain
  • Email
  • Gram
  • Gigabyte
  • Ip
  • Kilobyte
  • Kilogram
  • Megabyte
  • Money
  • Numeric
  • Ounce
  • Password
  • Path
  • PhoneNumber
  • Pound
  • PostalCode
  • Slug
  • Str
  • Url
  • Uuid

Coming soon

  • CreditCard
  • Duration
  • Foot
  • Hour
  • Kilometer
  • Meter
  • Minute
  • Percent
  • Second
  • Temperature