PHPackages                             pavlyuts/porta-datetime - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. pavlyuts/porta-datetime

ActiveLibrary[API Development](/categories/api)

pavlyuts/porta-datetime
=======================

PortaOne billing API datetime helper class

0.1.2(2y ago)024MITPHPPHP ^7.2

Since May 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/pavlyuts/porta-datetime)[ Packagist](https://packagist.org/packages/pavlyuts/porta-datetime)[ Docs](https://github.com/pavlyuts/porta-datetime)[ RSS](/packages/pavlyuts-porta-datetime/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

PortaOne Billing API datetime helper class
==========================================

[](#portaone-billing-api-datetime-helper-class)

Purpose
-------

[](#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
------------

[](#installation)

In the Composer storage. Just add proper require section:

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

```

Dependencies
------------

[](#dependencies)

- php: ^7.2

Testing
-------

[](#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
-------------

[](#documentation)

All methods has PHPdoc bloks, hope it is enough.

Usage sample
------------

[](#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.

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Total

3

Last Release

1080d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/51fb7e1bfe1a741b842ccaffe58a95229f1afa531676dff7d14e61cda27a9ae7?d=identicon)[pavlyuts](/maintainers/pavlyuts)

---

Top Contributors

[![pavlyuts](https://avatars.githubusercontent.com/u/6569739?v=4)](https://github.com/pavlyuts "pavlyuts (13 commits)")

---

Tags

apibillingportaoneportastart

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pavlyuts-porta-datetime/health.svg)

```
[![Health](https://phpackages.com/badges/pavlyuts-porta-datetime/health.svg)](https://phpackages.com/packages/pavlyuts-porta-datetime)
```

###  Alternatives

[maksekeskus/maksekeskus-php

Maksekeskus PHP SDK

12179.8k](/packages/maksekeskus-maksekeskus-php)[invoiced/invoiced

Invoiced PHP Library

14117.1k](/packages/invoiced-invoiced)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
