mkioschi / php-types
Common types for clean code PHP projects.
v1.0.2
2024-03-25 23:52 UTC
Requires
- php: >=8.3
- ext-intl: *
- cocur/slugify: ^4.2
- mkioschi/php-enums: ^1.0
- ramsey/uuid: ^4.7
Requires (Dev)
- phpunit/phpunit: ^9.5
README
Requirements
- PHP ^8.3
Installation
To install this module, run the following command in your terminal:
composer require mkioschi/php-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
- 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