afpinedac/common-value-objects 问题修复 & 功能扩展

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

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

afpinedac/common-value-objects

Composer 安装命令:

composer require afpinedac/common-value-objects

包简介

A collection of reusable value objects for PHP

README 文档

README

CommonValueObjects is a PHP package that provides a collection of reusable Value Objects for common data types, ensuring immutability, validation, and consistency in your applications.

📌 Installation

Install the package via Composer:

composer require afpinedac/common-value-objects

🚀 Features

  • ✅ Immutable Value Objects for safer data handling.
  • ✅ Strict Validation to prevent invalid values.
  • ✅ PSR-4 Autoloading for seamless integration.
  • ✅ Compatible with PHP 8+.

📂 Available Value Objects

Class Description
Percentage Represents a percentage value (e.g., 25%)
URL Represents a valid URL
Email Represents a valid Email
File Represents a File

🛠 Usage

Example: Using Percentage

use Afpinedac\CommonValueObjects\Numeric\Percentage;

$percentage = new Percentage(0.25);
echo $percentage->getFormatted(); // Output: 25.00%

Example: Using Latitude

use Afpinedac\CommonValueObjects\Geographic\Latitude;

$latitude = new Latitude(40.7128);
echo $latitude; // Output: 40.7128

✅ Running Tests

This package uses PestPHP for testing. To run tests, use:

vendor/bin/pest

📜 License

This package is released under the MIT License.

🤝 Contributing

Contributions are welcome! Feel free to submit pull requests or open issues on GitHub.

📬 Contact

For questions or feature requests, contact [Your Name] at your.email@example.com.

🚀 Start using CommonValueObjects today to improve data consistency in your PHP projects!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-28