Skip to content

A collection of generic Value Objects you should (always) use instead of PHP's primitive types.

License

Notifications You must be signed in to change notification settings

Mediagone/types-common

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Types Common

Latest Version on Packagist Total Downloads Software License

Value Objects are small and immutable classes representing typed values usually implemented using PHP primitive types. However, objects can embed validation to ensure that your data is always valid without adding any check elsewhere in your code. That's why you should ALWAYS use Value Objects rather than primitive types!

This package provides most common types you can use in any project.

Installation

This package requires PHP 7.4+

Add it as Composer dependency:

$ composer require mediagone/types-common

Available value-objects

All value-objects implement a common ValueObject interface and JsonSerializable.

Business

  • Bic
  • Iban

Crypto

  • Hash (abstract class)
  • HashBcrypt
  • HashArgon2id
  • RandomToken
  • Sha512

Note: all Hash* types are based on Hash base class, so they are perfectly interoperable.

Geo

  • Address
  • City
  • Country
  • Latitude
  • Longitude

Graphics

  • Color

System

  • Age
  • Base64
  • Binary
  • Count
  • Date
  • DateTimeUTC
  • DayOfMonth
  • Duration
  • Hex
  • Quantity

Text

  • Name
  • NameDigit
  • NameSpecial
  • Slug
  • SlugSnake
  • Text
  • TextMedium
  • Title

Web

  • EmailAddress
  • Url
  • UrlHost
  • UrlPath

License

Types Common is licensed under MIT license. See LICENSE file.

About

A collection of generic Value Objects you should (always) use instead of PHP's primitive types.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages