dannyb/phydrator
Composer 安装命令:
composer require dannyb/phydrator
包简介
PHP entity hydration
README 文档
README
A simple utility library for entity hydration in PHP.
Defining a Hydrator
All that should be necessary is to have an entity class (using PHP7.4+ property types), and then a very simple class such as this:
namespace PHydrator\Hydrator; use PHydrator\AbstractHydrator; class MyHydrator extends AbstractHydrator { protected const ENTITY_CLASS = MyEntity::class; }
Autoloading Hydrators
The recommended method of registering hydrators is to specify a namespace in the config when initialising PHydrator:
use PHydrator\Config; use PHydrator\PHydrator; // ... $config = new Config(); $config->autoloadNamespace = "App\\Hydrators"; $pHydrator = new PHydrator($config); // ...
If an autoload namespace isn't specified, you will need to manually register your hydrators.
Note that this is also an option if you have hydrators in other namespaces.
use PHydrator\PHydrator; // ... $pHydrator = new PHydrator(); $pHydrator->registerHydrator(MyHydrator::class); // ...
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-28