tourze / gb-t-7408
GB/T 7408
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/tourze/gb-t-7408
Requires
- php: ^8.1
- tourze/enum-extra: 0.1.*
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-10-31 07:40:49 UTC
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.