type-lang / mapper
将变量类型映射到其他类型的库
dev-master / 1.0.x-dev
2024-09-09 18:17 UTC
Requires
- php: ^8.1
- psr/simple-cache: ^1.0|^2.0|^3.0
- type-lang/parser: ^1.0
- type-lang/printer: ^1.0
- type-lang/reader: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.53
- jetbrains/phpstorm-attributes: ^1.0
- phplrt/compiler: ^3.6
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^1.11
- phpstan/phpstan-strict-rules: ^1.6
- phpunit/phpunit: ^10.5|^11.0
- rector/rector: ^1.1
- symfony/cache: ^5.4|^6.0|^7.0
This package is auto-updated.
Last update: 2024-09-09 18:17:23 UTC
README

你见过的最好的PHP映射器 =)
- 你可以在以下链接中看到一些示例
- 完整文档正在制作中...
安装
Mapper包作为Composer仓库提供,可以在项目根目录中使用以下命令进行安装
composer require type-lang/mapper
快速入门
class ExampleObject { public function __construct( public readonly string $name, ) {} } $mapper = new \TypeLang\Mapper\Mapper(); $normalized = $mapper->normalize(new ExampleObject('Example')); // Expected Result: // array:1 [ // "name" => "Example" // ] $denormalized = $mapper->denormalize($normalized, ExampleObject::class); // Expected Result: // ExampleObject {#14 // +name: "Example" // }