arokettu/ip-address-doctrine
最新稳定版本:1.0.3
Composer 安装命令:
composer require arokettu/ip-address-doctrine
包简介
Doctrine support for arokettu/ip-address
关键字:
README 文档
README
Doctrine support for arokettu/ip-address with support for native types in MariaDB and PostgreSQL.
Installation
composer require arokettu/ip-address-doctrine
Usage
Available types:
- Any version IP Address in text and binary form
- IPv4 Address in text and binary form
- IPv6 Address in text and binary form
- Any version IP Block in text and binary form
- IPv4 Block in text and binary form
- IPv6 Block in text and binary form
- Native PostgreSQL types:
inet,cidr - Native MariaDB types:
inet4,inet6
Example:
<?php use Arokettu\IP\AnyIPAddress; use Arokettu\IP\Doctrine\IPAddressType; use Arokettu\IP\Doctrine\VendorSpecific\PostgreSQL\InetType; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Mapping\Column; // first register types you need Type::addType(IPAddressType::NAME, IPAddressType::class); // native type should also be registered in the platform Type::addType(InetType::NAME, InetType::class); $db = DriverManager::getConnection(/* ... */); // when initializing DBAL $db->getDatabasePlatform()->registerDoctrineTypeMapping(InetType::NATIVE_TYPE, InetType::NAME); // apply to the object: class Model { #[Column(type: IPAddressType::NAME)] public AnyIPAddress $ip; #[Column(type: InetType::NAME)] public AnyIPAddress $native_ip; }
Documentation
Read full documentation here: https://sandfox.dev/php/ip-address-doctrine.html
Also on Read the Docs: https://arokettu-ip-address-doctrine.readthedocs.io/
Support
Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/ip-address-doctrine/-/issues
Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community
License
The library is available as open source under the terms of the MIT License.
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-14