hectororm / data-types
Hector Data Types
Installs: 3 686
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- ext-mbstring: *
- ext-pdo: *
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-02 15:07:01 UTC
README
Hector Data Types is the module to manage types of Hector ORM. Can be used independently of ORM.
Installation
Composer
You can install Hector Data Types with Composer, it's the recommended installation.
$ composer require hectororm/data-types
Dependencies
- PHP ^8.0
- Extensions dependencies:
- ext-pdo
Usage
Each type converter implement interface:
use Hector\DataTypes\ExpectedType; interface TypeInterface { /** * From schema function. * * @return string|null */ public function fromSchemaFunction(): ?string; /** * From schema to entity. * * @param mixed $value * @param ExpectedType|null $expected * * @return mixed */ public function fromSchema(mixed $value, ?ExpectedType $expected = null): mixed; /** * To schema function. * * @return string|null */ public function toSchemaFunction(): ?string; /** * From entity to schema. * * @param mixed $value * @param ExpectedType|null $expected * * @return mixed */ public function toSchema(mixed $value, ?ExpectedType $expected = null): mixed; /** * Get binding type. * Must return a PDO::PARAM_* value. * * @return int|null */ public function getBindingType(): ?int; }
Attempted excepted type is a representation of PHP type of property.