PHPackages                             dpeuscher/util - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dpeuscher/util

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dpeuscher/util
==============

Code that extends existing basic PHP-functionality

1.1.1(7y ago)08.5k—0%2[22 PRs](https://github.com/dpeuscher/util/pulls)1MITPHP

Since Jul 1Pushed 5y ago1 watchersCompare

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

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

[![Build Status](https://camo.githubusercontent.com/bd642245f91f8c52403fcd943c8ccc366a8405000ca8df6c5133425407480a15/68747470733a2f2f7472617669732d63692e6f72672f6470657573636865722f7574696c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dpeuscher/util) [![codecov](https://camo.githubusercontent.com/b90b478c6872f62118cf91e26ed17597966d634ed075b2139c99f778dd902a07/68747470733a2f2f636f6465636f762e696f2f67682f6470657573636865722f7574696c2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/dpeuscher/util)[![FOSSA Status](https://camo.githubusercontent.com/df2f3bb0d9f4f16918c003f6f9c6674bc1206b46e9cefbcdb774157226e2d1ee/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532466470657573636865722532467574696c2e7376673f747970653d736869656c64)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdpeuscher%2Futil?ref=badge_shield)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3809a42ac52f5a2fad8b9b997e75b4ca52964c4d0e21161ee298db95ad34ed30/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6470657573636865722f7574696c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dpeuscher/util/?branch=master)

util
====

[](#util)

Code that extends existing basic PHP-functionality

```
$from = '5'; // possible also: '1.5.', '5-1', '2018-05-01'
$to = '7';

$dateHelper = new DateHelper();
list($fromDateTime, $toDateTime) = $dateHelper->buildDateTimeRangeFromTwoInputs($from, $to);
// Default $to is generated by third parameter as DateInterval:
// list($fromDateTime, $toDateTime) = $dateHelper->buildDateTimeRangeFromTwoInputs($from, null, 'P2M');

var_export([$fromDateTime->format('Y-m'), $toDateTime->format('Y-m')]);
```

Result looks like this: (given today is 2018)

> array ( 0 =&gt; '2018-05-01', 1 =&gt; '2018-08-01', )

```
$dateHelper = new DateHelper();
$date = $dateHelper->buildDateTimeSince('P3D'); // Interval param defaults to P7D = 1 week - will use P1D if not parsable

print($date->format('Y-m-d'));
```

Result looks like this: (given today is 2018-05-01)

> 2018-05-04

```
$dateHelper = new DateHelper();
$text = $dateHelper->diffToText(new DateInterval('P3DPT4H5M6S'));

print($text);
```

Result looks like this:

> 3d 4h 5m 6s

```
$text = StringHelper::trim('Longtext', 5);

print($text);
```

Result looks like this:

> Longt...

```
$text = StringHelper::shortenNameToFirst('John Doe');

print($text);
```

Result looks like this:

> John D

License
-------

[](#license)

[![FOSSA Status](https://camo.githubusercontent.com/6a1dccda896ef9af19ff45993f42ad24cd93e5c6ac4204677e29c2852cbbbe1f/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532466470657573636865722532467574696c2e7376673f747970653d6c61726765)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdpeuscher%2Futil?ref=badge_large)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 51.9% 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 ~47 days

Total

3

Last Release

2784d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/962f3d9f38b70f4c7d20d9536d5e495b276855977117e27ef7df7fdc8c923f43?d=identicon)[dpeuscher](/maintainers/dpeuscher)

---

Top Contributors

[![dpeuscher](https://avatars.githubusercontent.com/u/2235055?v=4)](https://github.com/dpeuscher "dpeuscher (14 commits)")[![violinist-bot](https://avatars.githubusercontent.com/u/27495990?v=4)](https://github.com/violinist-bot "violinist-bot (12 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dpeuscher-util/health.svg)

```
[![Health](https://phpackages.com/badges/dpeuscher-util/health.svg)](https://phpackages.com/packages/dpeuscher-util)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

374468.4k51](/packages/flow-php-etl)[gehrisandro/tailwind-merge-php

TailwindMerge for PHP merges multiple Tailwind CSS classes by automatically resolving conflicts between them

1391.5M9](/packages/gehrisandro-tailwind-merge-php)[nelexa/google-play-scraper

Scrapes app data from Google Play store.

88487.4k](/packages/nelexa-google-play-scraper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[llm/mcp-server

PHP SDK for building MCP servers

431.1k](/packages/llm-mcp-server)

PHPackages © 2026

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