gtmassey/days 问题修复 & 功能扩展

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

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

gtmassey/days

最新稳定版本:v1.0

Composer 安装命令:

composer require gtmassey/days

包简介

An extracted class that I wrote to help with managing days of the week as string objects. It does one thing and one thing only: convert a day of the week name to an abbreviation and back.

README 文档

README

Latest Version on Packagist Tests Total Downloads

Simple helper class for accessing the days of the week as strings in PHP.

Note from the developer:

This package is literally only one class. I will likely never update this package again. I just wanted to make a simple helper class for switching between days as names and as abbreviations in a separate project. If you have any suggestions for features or ideas, feel free to fork!

Thanks,

Garrett

Installation

You can install the package via composer:

composer require gtmassey/days

Usage

To use, you can either create a new days object with the new keyword, or you can use the make static method, or you can call the day of week directly as a static method:

use Gtmassey\Days\Days;

$monday = new Days('Monday');
$tuesday = Days::make('Tuesday');
$wednesday = Days::Wednesday();

Once you have a Days object, you can call the various methods to return the day of the week as a specific English formatted string:

$monday->asCharacterCode();      //'M'
$monday->asShortName();          //'Mon'
$sunday->asCharacterCode();      //'U'
$thursday->asFullName();         //'Thursday'

The character codes use R for Thursday to avoid confusion with Tuesday and U for Sunday to avoid confusion with Saturday.

Testing

To run the testsuite, run the following command:

composer test

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-29