xdevor/type 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xdevor/type

Composer 安装命令:

composer require xdevor/type

包简介

A Laravel package which object type collection powered by Laravel's validation components.

README 文档

README

In this package we've introduced a new type package that focuses on validating object types.

This package not only allows you to validate basic data types but also supports complex object structures. Using Laravel's fluent validation syntax, you can define the expected properties of an object to ensure their types and existence.

Test Status Total Downloads packagist License

Installation

Require this package with composer:

composer require xdevor/type

Usage

  • ❌ Without object type
function increase(int $count)
{
    if ($count < 1) {
        throw new InvalidArgumentException('Receive invalid argument');
    }
    return $this->value + $count;
}
  • ✅ With object type
use Xdevor\Type\Numbers\PositiveInt;

function increase(PositiveInt $count)
{
    return $this->value + $count->value();
}

Features

Supports

  1. PositiveInt: Positive integer
  2. NegativeInt: Negative integer

Todo

  1. NonZeroInt: Non-zero integer
  2. PositiveFloat: Positive floating-point number
  3. NegativeFloat: Negative floating-point number
  4. NonZeroFloat: Non-zero floating-point number
  5. NonEmptyString: Non-empty string
  6. EmailAddress: Email address
  7. Url: URL
  8. PhoneNumber: Phone number
  9. Date: Date
  10. DateTime: Date and time
  11. Uuid: Universally Unique Identifier (UUID)
  12. IPv4Address: IPv4 address
  13. IPv6Address: IPv6 address
  14. HexColorCode: Hexadecimal color code
  15. AlphanumericString: Alphanumeric string
  16. Json: JSON string
  17. ArrayOfType: Array of a specific type
  18. CustomEnum: Custom enumeration type
  19. CreditCardNumber: Credit card number
  20. SocialSecurityNumber: Social Security number
  21. LatitudeLongitude: Latitude and longitude coordinates
  22. CurrencyAmount: Currency amount
  23. Percentage: Percentage value
  24. FileSize: File size
  25. TimeInterval: Time interval
  26. ISBN: International Standard Book Number (ISBN)
  27. MACAddress: MAC address
  28. IBAN: International Bank Account Number (IBAN)
  29. Password: Password with specific constraints
  30. PostalCode: Postal code
  31. CreditScore: Credit score
  32. FahrenheitTemperature: Temperature in Fahrenheit
  33. CelsiusTemperature: Temperature in Celsius
  34. BinaryData: Binary data
  35. Gender: Gender (Male/Female/Other)
  36. Latitude: Latitude coordinate
  37. Longitude: Longitude coordinate
  38. ISBN13: ISBN-13
  39. IMEI: International Mobile Equipment Identity (IMEI)
  40. CreditCardExpirationDate: Credit card expiration date
  41. VATNumber: Value Added Tax (VAT) number
  42. HexadecimalNumber: Hexadecimal number
  43. BooleanString: Boolean represented as a string
  44. RomanNumeral: Roman numeral
  45. PassportNumber: Passport number
  46. MIMEType: Multipurpose Internet Mail Extensions (MIME) type
  47. MACAddressOUI: MAC address Organizationally Unique Identifier (OUI)
  48. EAN13: International Article Number (EAN-13)
  49. EAN8: International Article Number (EAN-8)
  50. VehicleIdentificationNumber (VIN): VIN for vehicles
  51. ISSN: International Standard Serial Number (ISSN)
  52. UPC: Universal Product Code (UPC)
  53. GS1Barcode: GS1 Barcode
  54. MD5Hash: MD5 hash
  55. SHA1Hash: SHA-1 hash
  56. SHA256Hash: SHA-256 hash
  57. SHA512Hash: SHA-512 hash
  58. RGBColor: RGB color
  59. RGBAColor: RGBA color (with alpha channel)
  60. HSLColor: HSL color
  61. HSLAColor: HSLA color (with alpha channel)
  62. HTMLColorName: HTML color name
  63. Base64EncodedString: Base64-encoded string
  64. ISBN10: ISBN-10
  65. USStateAbbreviation: US state abbreviation
  66. CanadianPostalCode: Canadian postal code
  67. SocialMediaUsername: Social media username
  68. HexadecimalRGBColor: Hexadecimal RGB color
  69. AlphabeticalString: Alphabetical string
  70. MongoDBObjectId: MongoDB Object ID
  71. JWToken: JSON Web Token (JWT)
  72. UnixTimestamp: Unix timestamp
  73. YouTubeVideoId: YouTube video ID
  74. HexadecimalUUID: Hexadecimal UUID
  75. HTTPStatusCode: HTTP status code
  76. SemVer: Semantic versioning string
  77. EpochTime: Epoch time
  78. HexadecimalMACAddress: Hexadecimal MAC address
  79. GoogleAnalyticsTrackingId: Google Analytics tracking ID
  80. USZipCode: US ZIP code
  81. Slug: URL-friendly slug
  82. TwitterHandle: Twitter handle
  83. HexadecimalBinary: Hexadecimal binary data
  84. RandomGuid: Randomly generated GUID
  85. ICAOAirportCode: ICAO airport code
  86. HexadecimalHTMLColor: Hexadecimal HTML color code
  87. GitCommitHash: Git commit hash
  88. CustomMimeType: Custom MIME type
  89. GPSCoordinates: GPS coordinates
  90. AmericanExpressCardNumber: American Express credit card number
  91. MasterCardNumber: MasterCard credit card number
  92. VisaCardNumber: Visa credit card number
  93. DinersClubCardNumber: Diners Club credit card number
  94. DiscoverCardNumber: Discover credit card number
  95. JCBCardNumber: JCB credit card number
  96. DebitCardNumber: Debit card number
  97. WindowsFilePath: Windows file path
  98. UnixFilePath: Unix file path
  99. CurrencyCode: Represents the code of a currency (e.g., USD, EUR).
  100. CurrencyAmount: Represents the numerical value of an amount in a specific currency.
  101. ExchangeRate: Represents the exchange rate between two currencies.
  102. CryptocurrencyCode: Represents the code of a cryptocurrency (e.g., BTC, ETH).
  103. CryptocurrencyAmount: Represents the numerical value of an amount in a specific cryptocurrency.
  104. BitcoinAddress: Represents a Bitcoin wallet address.
  105. EthereumAddress: Represents an Ethereum wallet address.
  106. LitecoinAddress: Represents a Litecoin wallet address.
  107. RippleAddress: Represents a Ripple wallet address.
  108. MoneroAddress: Represents a Monero wallet address.
  109. StellarAddress: Represents a Stellar wallet address.
  110. EOSAddress: Represents an EOS wallet address.
  111. DashAddress: Represents a Dash wallet address.
  112. ZcashAddress: Represents a Zcash wallet address.
  113. USDCurrency: Represents the United States Dollar (USD).
  114. EuroCurrency: Represents the Euro (EUR).
  115. BritishPoundCurrency: Represents the British Pound (GBP).
  116. JapaneseYenCurrency: Represents the Japanese Yen (JPY).
  117. CanadianDollarCurrency: Represents the Canadian Dollar (CAD).
  118. AustralianDollarCurrency: Represents the Australian Dollar (AUD).
  119. SwissFrancCurrency: Represents the Swiss Franc (CHF).
  120. ChineseYuanCurrency: Represents the Chinese Yuan (CNY).
  121. IndianRupeeCurrency: Represents the Indian Rupee (INR).
  122. BrazilianRealCurrency: Represents the Brazilian Real (BRL).
  123. SouthAfricanRandCurrency: Represents the South African Rand (ZAR).
  124. SwedishKronaCurrency: Represents the Swedish Krona (SEK).
  125. NorwegianKroneCurrency: Represents the Norwegian Krone (NOK).
  126. SingaporeDollarCurrency: Represents the Singapore Dollar (SGD).
  127. NewZealandDollarCurrency: Represents the New Zealand Dollar (NZD).
  128. MexicanPesoCurrency: Represents the Mexican Peso (MXN).

Contributing

Please see CONTRIBUTING for details.

Code of Conduct

In order to ensure that the php community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

This package is open-sourced software licensed under the MIT license.

xdevor/type 适用场景与选型建议

xdevor/type 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「validation」 「type」 「laravel」 「Value Object」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 xdevor/type 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 xdevor/type 我们能提供哪些服务?
定制开发 / 二次开发

基于 xdevor/type 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-11