PHPackages                             geeksareforlife/utilities - 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. geeksareforlife/utilities

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

geeksareforlife/utilities
=========================

Various general purpose utilities

0.2.0(5y ago)034MITPHPPHP ^5.3.3 || ^7.0CI failing

Since Apr 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/geeksareforlife/utilities)[ Packagist](https://packagist.org/packages/geeksareforlife/utilities)[ Docs](https://github.com/geeksareforlife/utilities)[ RSS](/packages/geeksareforlife-utilities/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependenciesVersions (6)Used By (0)

Utilities
=========

[](#utilities)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8795911e12c8e4f727f4f6e4b98f5dd8f7b44a171ebc7216e271a9e306c9fe37/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765656b73617265666f726c6966652f7574696c69746965732e7376673f7374796c653d666c6174)](https://packagist.org/packages/geeksareforlife/utilities)[![Tests](https://github.com/geeksareforlife/utilities/workflows/Tests/badge.svg)](https://github.com/geeksareforlife/utilities/workflows/Tests/badge.svg)[![Analysis](https://github.com/geeksareforlife/utilities/workflows/Analysis/badge.svg)](https://github.com/geeksareforlife/utilities/workflows/Analysis/badge.svg)[![Code Sniffer](https://github.com/geeksareforlife/utilities/workflows/Code%20Sniffer/badge.svg)](https://github.com/geeksareforlife/utilities/workflows/Code%20Sniffer/badge.svg)[![Contributor Covenant](https://camo.githubusercontent.com/2757a9db291c5ceda172e31d4fa5f3c4048a6e6257ee0b7113f80de277074b91/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e7472696275746f72253230436f76656e616e742d76322e3025323061646f707465642d6666363962342e737667)](CODE_OF_CONDUCT.md)

This small package is simply a collection of functions that I find useful across multiple projects.

Installation
------------

[](#installation)

Install using [Composer](https://getcomposer.org/):

```
composer require geeksareforlife/utilities

```

The only requirement at this time is PHP 7.1 and above.

Usage
-----

[](#usage)

The package provides static functions grouped into classes. See the list of functions below.

When using, you can either call the functions using the fully qualified name:

```
$newArray = GeeksAreForLife\Utilities\Arrays::sanitiseArray($array, $keys);

```

or have a use statement at the top of your file:

```
use GeeksAreForLife\Utilities\Arrays;
...
$newArray = Arrays::sanitiseArray($array, $keys);

```

### Arrays::sanitiseArray($array, $keys)

[](#arrayssanitisearrayarray-keys)

This function takes two arguments - the array you want to sanitise and a list of keys you want in the returned array.

For example, given this as an input array:

```
$array = [
  'red'   => 'abc',
  'green' => true,
  'blue'  => [1, 2, 3],
  ];

```

and the following as the list of keys:

```
$keys = ['red', 'blue', 'yellow'];

```

The returned array will be:

```
$array = [
  'red'   => 'abc',
  'blue'  => [1, 2, 3],
  ];

```

Notice that `yellow` does not appear as a key.

### Arrays::sanitiseArrayList($list, $keys)

[](#arrayssanitisearraylistlist-keys)

This function takes the provided list of arrays and sanitises each one before returning a list of the sanitised arrays.

The individual arrays are santised in exactly the same way as noted in the previous function.

### Strings::startsWith($string, $startsWith)

[](#stringsstartswithstring-startswith)

This function checks if the provided `$string` starts with `$startsWith` and returns either `true` or `false`.

`$startsWith` can be of any length. An empty string in `$startsWith` will return `true`.

### Strings::endsWith($string, $endsWith)

[](#stringsendswithstring-endswith)

This function checks if the provided `$string` ends with `$endsWith` and returns either `true` or `false`

`$endsWith` can be of any length. An empty string in `$endsWith` will return `true`.

Contributing
------------

[](#contributing)

Firstly, I am really happy that you are thinking about contributing to this project.

You can find the [Contributing Guidelines](CONTRIBUTING.md) in the root of this repository.

Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.

### Filing a Bug or Requesting a feature

[](#filing-a-bug-or-requesting-a-feature)

Both of these are contributing too! You can find details on how to do both in the [Contributing Guidelines](CONTRIBUTING.md).

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.2% 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 ~317 days

Total

5

Last Release

2095d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/41cf0cacc86d2eb2bad1af040e198a0170ca71ca9c5943212b7c183bc833238d?d=identicon)[geeksareforlife](/maintainers/geeksareforlife)

---

Top Contributors

[![geeksareforlife](https://avatars.githubusercontent.com/u/1926944?v=4)](https://github.com/geeksareforlife "geeksareforlife (34 commits)")[![Brunty](https://avatars.githubusercontent.com/u/1573273?v=4)](https://github.com/Brunty "Brunty (5 commits)")

---

Tags

hacktoberfest

### Embed Badge

![Health badge](/badges/geeksareforlife-utilities/health.svg)

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

###  Alternatives

[nmaier95/shopify-product-fetcher

Shopify for Craft CMS

534.9k](/packages/nmaier95-shopify-product-fetcher)

PHPackages © 2026

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