PHPackages                             s-mcdonald/functions - 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. s-mcdonald/functions

ActiveLibrary

s-mcdonald/functions
====================

assortment of php functions

0.3.0(2y ago)013MITPHPPHP &gt;=8.0

Since May 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/s-mcdonald/Functions)[ Packagist](https://packagist.org/packages/s-mcdonald/functions)[ Docs](https://github.com/s-mcdonald/Functions)[ RSS](/packages/s-mcdonald-functions/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (8)Used By (0)

Functions
=========

[](#functions)

[![Source](https://camo.githubusercontent.com/b0fa7fe0a303018e8c3063b1480830471bb56c9f5ea456aca9d16eb312905baa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d535f4d63446f6e616c642d626c75652e737667)](https://github.com/s-mcdonald/Functions)[![Source](https://camo.githubusercontent.com/46ed314e73590919c29d4f70d8319d8462b1d8fcc9892ec2902cdb34f2ddf6fa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d676f6c642e737667)](https://github.com/s-mcdonald/Functions)

### Setup.

[](#setup)

First install via composer, then import the function in the using statements. eg:

```
use function SamMcDonald\Functions\random_bool;
```

### `random_bool`

[](#random_bool)

```
random_bool() ? 'foo' : 'bar';
```

### `array_rand_bias`

[](#array_rand_bias)

```
echo array_rand_bias($array);
```

For example, take the following array of names;

```
$myarray = [
    'David',
    'Matthew',
     ...
    'George',
];
```

There is a descending trend in the names from the start of the index such as David. So David will be picked mostly, then Mathew and so on until the last element.

### `array_entry_exist`

[](#array_entry_exist)

```
if (array_entry_exist($array, 'foo', 'bar')) {...}

// Which is a more convenient way of typing
if (isset($array['foo']) && $array['foo'] === 'bar') {}
```

### `array_rand_pluck`

[](#array_rand_pluck)

```
$randomValue = array_rand_pluck($array);

// Alternative
$randomValue = $array[array_rand($array, 1)];
```

### `like_int`

[](#like_int)

```
$like_int = "55";

if(like_int($like_int)) {
    echo "Yes this is could certainly be cast to an int.", PHP_EOL;
}
```

### `slugify`

[](#slugify)

```
echo slugify("My friends long weekend at Bernie's");
```

Install via composer
--------------------

[](#install-via-composer)

```
composer require s-mcdonald/functions

```

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

[](#dependencies)

- Php 8.0

License
-------

[](#license)

Functions is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT)(See LICENSE file for details).

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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 ~3 days

Total

6

Last Release

1077d ago

PHP version history (3 changes)0.0.1PHP &gt;=8.1

0.1.0PHP &gt;=7.4

0.3.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1759b23f11dcfe1753788c7d3fe306af5bfcb11d1e199ccee0b8ad04b70bc00a?d=identicon)[S-McDonald](/maintainers/S-McDonald)

---

Top Contributors

[![s-mcdonald](https://avatars.githubusercontent.com/u/1879824?v=4)](https://github.com/s-mcdonald "s-mcdonald (22 commits)")

---

Tags

slugifyrandom\_boolarray\_rand\_biasrand\_biaslike\_intarray\_entry\_existlike\_float

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/s-mcdonald-functions/health.svg)

```
[![Health](https://phpackages.com/badges/s-mcdonald-functions/health.svg)](https://phpackages.com/packages/s-mcdonald-functions)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[cocur/slugify

Converts a string into a slug.

3.0k66.7M328](/packages/cocur-slugify)[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6737.4M62](/packages/jbroadway-urlify)[ausi/slug-generator

Slug Generator

8002.2M22](/packages/ausi-slug-generator)[jbzoo/utils

Collection of PHP functions, mini classes and snippets for everyday developer's routine life.

8321.5M36](/packages/jbzoo-utils)[symfony-cmf/slugifier-api

Provides a basic slugifier interface to transform text into strings suitable for URLs

281.7M5](/packages/symfony-cmf-slugifier-api)

PHPackages © 2026

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