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

0.0.1 2025-05-29 10:23 UTC

This package is auto-updated.

Last update: 2025-10-31 07:40:49 UTC


README

English | δΈ­ζ–‡

Latest Version Quality Score Total Downloads License

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-extra package

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

Changelog

Please see CHANGELOG.md for more information on what has changed recently.