tourze/gb-t-7408
最新稳定版本:0.0.1
Composer 安装命令:
composer require tourze/gb-t-7408
包简介
GB/T 7408
README 文档
README
A PHP package implementing GB/T 7408 standard for data elements and interchange formats - Information interchange - Representation of dates and times. This package provides a standardized way to handle weekday representations according to Chinese national standards.
Features
- ✅ Standards Compliant: Implements GB/T 7408 national standard for date and time representation
- 🔢 Numeric Values: Uses standardized numeric values (01-07) for weekdays
- 🌐 Localized Labels: Provides Chinese labels for all weekdays
- 🚀 Modern PHP: Built with PHP 8.1+ enums for type safety
- 🔧 Easy Integration: Simple API for date and time related systems
- 📦 Lightweight: Minimal dependencies, only requires
tourze/enum-extra
Requirements
- PHP 8.1 or higher
tourze/enum-extrapackage
Installation
You can install the package via Composer:
composer require tourze/gb-t-7408
Quick Start
<?php use Tourze\GBT7408\Weekday; // Get all weekday options as array $weekdays = Weekday::items(); // Returns: ['01' => '星期一', '02' => '星期二', ...] // Get the Chinese label of a weekday echo Weekday::Monday->getLabel(); // Output: "星期一" echo Weekday::Sunday->getLabel(); // Output: "星期日" // Get the numeric value (GB/T 7408 standard) echo Weekday::Monday->value; // Output: "01" echo Weekday::Sunday->value; // Output: "07" // Use in select options $selectOptions = Weekday::select(); foreach ($selectOptions as $value => $label) { echo "<option value=\"$value\">$label</option>\n"; } // Convert from standard values $monday = Weekday::from('01'); echo $monday->getLabel(); // Output: "星期一"
Standard Reference
This package implements the Chinese national standard GB/T 7408 for date and time representation. According to this standard, weekdays are represented using numeric values from 01 to 07, where:
01= Monday (星期一)02= Tuesday (星期二)03= Wednesday (星期三)04= Thursday (星期四)05= Friday (星期五)06= Saturday (星期六)07= Sunday (星期日)
References
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Guidelines
- Follow PSR-12 coding standards
- Add tests for any new features
- Update documentation as needed
- Ensure all tests pass before submitting PR
Testing
# Run tests composer test # Run static analysis composer analyse
License
The MIT License (MIT). Please see License File for more information.
Credits
- Author: tourze
- Contributors: All Contributors
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-03