PHPackages                             stinger-soft/php-commons - 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. stinger-soft/php-commons

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

stinger-soft/php-commons
========================

Some common php functions

1.2.0(5y ago)07.5k↓41.7%5Apache-2.0PHPPHP &gt;=7.2

Since Aug 15Pushed 1y ago3 watchersCompare

[ Source](https://github.com/Stinger-Soft/PhpCommons)[ Packagist](https://packagist.org/packages/stinger-soft/php-commons)[ Docs](http://www.stinger-soft.net)[ RSS](/packages/stinger-soft-php-commons/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (5)

PhpCommons
==========

[](#phpcommons)

Some common methods to ease the life of anonymous PHP developers

String
------

[](#string)

- **startsWith** Tests if a string starts with the specified prefix.
- **endsWith** Tests if a string ends with the specified suffix
- **camelize** Uppercases the first character of each word in a string
- **excerpt** Creates an excerpt from a text based on a phrase
- **truncate** Truncates a given string after a given length (if necessary)
- **highlight** Highlights (i.e. adds html-tags arround the keyword) a given keyword in a string
- **hashCode** Get the integer based hash code of a given string

Array
-----

[](#array)

- **insertElement** Adds an element into a array on the given position without replacing the old entry
- **removeElementByValue** Removes the given element from the array
- **mergeArrayValues** Creates an array of arrays from the two given arrays.
- **getPrevKey** Returns the previous key from an array
- **getNextKey** Returns the next key from an array
- **applyCallbackByPath** Applies a callback on a part of a multidimensional array defined by its path (i.e. keys)

Integer
-------

[](#integer)

- **intcmp** Compares two integers (similarly to `strcmp`) and returns whether the first argument is smaller, less or equal to the second argument.
- **isInteger** Checks if a given value can be interpreted as a "real" integer without commas or exponent parts (i.e. `1e10` is *not* treated as an integer).

Formatter
---------

[](#formatter)

### Byte

[](#byte)

- **prettyPrintSize** Pretty prints a given memory/file size (e.g. 1024 -&gt; 1kB)

### Time

[](#time)

- **prettyPrintMicroTimeInterval** Pretty prints an interval specfied by two timestamps.
- **getRelativeTimeDifference** Get the relative difference between a given start time and end time.

HashCodeBuilder
---------------

[](#hashcodebuilder)

Allows building a hash code by chaining different values defining an individual hash.

```
$hashBuilder = new HashBuilder();
$hashCode = $hashBuilder
    ->append($item->getId())
    ->append($item->isEnabled())
    ->append($item->getName())
    ->toHashCode();
```

[![Build Status](https://camo.githubusercontent.com/6bf70196feb6a6fd04bc1a0429920700c2913872218b49def3fa87e76158afc1/68747470733a2f2f7472617669732d63692e6f72672f5374696e6765722d536f66742f506870436f6d6d6f6e732e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/Stinger-Soft/PhpCommons)[![Coverage Status](https://camo.githubusercontent.com/970282b0517345c0c9d64ca291c5e3dc96f1f1edd15b907c7860ba641156caf1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f5374696e6765722d536f66742f506870436f6d6d6f6e732f62616467652e7376673f6272616e63683d646576656c6f70)](https://coveralls.io/github/Stinger-Soft/PhpCommons?branch=develop)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 62.3% 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 ~705 days

Total

3

Last Release

2152d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.4

1.2.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2f01fea764b969355a878a17f1a26cee49f4acccf17a79fd36527042e07384c?d=identicon)[Viburnum](/maintainers/Viburnum)

---

Top Contributors

[![Viburnum](https://avatars.githubusercontent.com/u/2122889?v=4)](https://github.com/Viburnum "Viburnum (33 commits)")[![koddistortion](https://avatars.githubusercontent.com/u/1405569?v=4)](https://github.com/koddistortion "koddistortion (19 commits)")[![nea](https://avatars.githubusercontent.com/u/392035?v=4)](https://github.com/nea "nea (1 commits)")

---

Tags

phpcommons

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stinger-soft-php-commons/health.svg)

```
[![Health](https://phpackages.com/badges/stinger-soft-php-commons/health.svg)](https://phpackages.com/packages/stinger-soft-php-commons)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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