定制 pavlyuts/porta-datetime 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

pavlyuts/porta-datetime

最新稳定版本:0.1.2

Composer 安装命令:

composer require pavlyuts/porta-datetime

包简介

PortaOne billing API datetime helper class

README 文档

README

Purpose

This package intended to simplify datetime and data fields management when work with Portabilling API.

PortaDateTime class exptends standatd DateTime class to provide specific methods. All the datatime fields of API has MySQL format and always UTC timezone. This helper class allows:

  • Create a PortaDateTime class with desired timezone from Portaone UTC-based datetime API string.
  • Create PortaDateTime class for any datetime and any timezone and get billing-format UTC datetime string
  • Also use any method of DateTime

Installation

In the Composer storage. Just add proper require section:

"require": {
    "pavlyuts/porta-datetime": "^0.1"
}

Dependencies

  • php: ^7.2

Testing

Tested with PHPUnit 8.5 on php 7.2, up to 100% coverage, which does not mean everything will work as intended.

To test, install in dev mode and use:

  • composer test command from library root for run all standard modular tests

Documentation

All methods has PHPdoc bloks, hope it is enough.

Usage sample

// Typical PortaBilling API datetime string
$portaDateTime = = '2023-03-20 07:38:17';

// Create PortaDateTime from the string
$dateTime = \PortaDateTime::createFromPortaString(self::DATETIME, 'Asia/Seoul');

// Let's say we need to cancel addon product at the last second of today, local time
// First, create the object for 'now' at local timezone
$dateTime = new \PortaDateTime('now', 'Asia/Seoul');
// Get the string with 'last moment of the day' in UTC, ready to pass to the billing
$addonValidToString = $dateTime->getLastMomentString();
//Then, variable contains datetime string you may put to API call field, in UTC format.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固