PHPackages                             straylightagency/helpers - 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. straylightagency/helpers

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

straylightagency/helpers
========================

Some raw and useful helpers functions

v0.1.0(5mo ago)013MITPHPPHP &gt;=8.3.0

Since Jan 26Pushed 1mo agoCompare

[ Source](https://github.com/straylightagency/php-helpers)[ Packagist](https://packagist.org/packages/straylightagency/helpers)[ Docs](https://github.com/straylightagency/php-helpers)[ RSS](/packages/straylightagency-helpers/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

PHP Helpers
===========

[](#php-helpers)

Just some raw and useful helpers functions.

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

[](#installation)

Require this package with composer.

```
composer require straylightagency/helpers
```

The main file, `index.php` is loaded through Composer using autoloaded files.

API Documentation
-----------------

[](#api-documentation)

Format a comma separated float "65,25" into a regular dotted float "65.25", useful for pricing.

```
price_format(num: mixed, decimals: int = 2, decimal_separator: string|null = ".", thousands_separator: string|null = "" ): float
```

Check if an int|float value is within a certain bound. If the value is in range it returns the value, if the value is not in range it returns the nearest bound.

```
clamp(value: int|float, min: int|float, max: int|float): float|int
```

Get the contents of a svg file, applying a class list on it before returning if `$class_list` is not null.

```
svg_get_contents(file_path: string, class_list: string|null = null): string
```

Convert iso code to emoji.

```
iso_to_emoji(code: string): string
```

Same as array\_map but the callback get the key associated to the value.

```
array_map_keys(callback: callable|null, array: array): array
```

Do a preg\_match\_all using callback with patterns.

```
preg_match_callback_array(patterns: array, subject: string): array
```

Equivalent to array\_diff but recursively.

```
array_recursive_diff(a: array, b: array):array
```

Remove the first item(s) of an array if values are empty.

```
array_clean_first(array: array): array
```

Remove the last item(s) of an array if values are empty.

```
array_clean_last(array: array): array
```

Ensure the value is an array, otherwise returns an empty array. Avoid foreach error when the value is not an expected array.

```
array_safe(array: mixed): array
```

Explode a content string into an array of multiple lines based on carriage return characters.

```
split_content(content: string): array
```

Remove the `` tags on a text.

```
strip_p(content: string): string
```

Easy way to split a text after $limit words without cutting through the middle of a word.

```
text_excerpt(content: string, limit: int = 35, end: string = '...'): string
```

Return a valid Google Maps url using address information provided. Second parameter `itinerary` allows to return an itinerary path instead of a pin on the map.

```
google_maps_url(address: array, itinerary: bool = false): string
```

Find the ID of a video from the Vimeo url. Return null if it failed.

```
vimeo_id(vimeo_url: string): int|null
```

Find the ID of a video from the YouTube url. Return null if it failed.

```
youtube_id(youtube_url: string): string|null
```

Un-quote a JSON string before decoding.

```
json_stripslashes_decode(json: string, associative: bool|null = null, depth: int = 512, flags: int = 0): mixed
```

Requirement
-----------

[](#requirement)

PHP 8.3 or above

See also
--------

[](#see-also)

Credits
-------

[](#credits)

- [Anthony Pauwels](https://github.com/anthonypauwels)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance82

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

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

Unknown

Total

1

Last Release

158d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4163238?v=4)[Anthony Pauwels](/maintainers/anthonypauwels)[@anthonypauwels](https://github.com/anthonypauwels)

---

Top Contributors

[![anthonypauwels](https://avatars.githubusercontent.com/u/4163238?v=4)](https://github.com/anthonypauwels "anthonypauwels (5 commits)")

---

Tags

helpers

### Embed Badge

![Health badge](/badges/straylightagency-helpers/health.svg)

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

###  Alternatives

[danielstjules/stringy

A string manipulation library with multibyte support

2.4k26.3M192](/packages/danielstjules-stringy)[voku/arrayy

Array manipulation library for PHP, called Arrayy!

4915.7M18](/packages/voku-arrayy)[voku/stringy

A string manipulation library with multibyte support

1863.9M26](/packages/voku-stringy)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

3361.0M51](/packages/dereuromark-cakephp-tools)[browner12/helpers

generic helpers

289706.9k7](/packages/browner12-helpers)[rappasoft/laravel-helpers

Laravel Helpers for Non-Laravel Projects

277681.9k22](/packages/rappasoft-laravel-helpers)

PHPackages © 2026

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