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(3mo ago)07MITPHPPHP &gt;=8.3.0

Since Jan 26Pushed 3mo 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 1mo ago

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
```

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 = ".", thousands_separator: ?string = "" ): 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): 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, 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(string $content): array
```

Remove the `` tags on a text.

```
strip_p(string $string): string
```

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

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

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

```
google_map_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
```

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

```
youtube_id(youtube_url: string): ?string
```

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

34

—

LowBetter than 77% of packages

Maintenance79

Regular maintenance activity

Popularity4

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

112d 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 (4 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.0M191](/packages/danielstjules-stringy)[voku/arrayy

Array manipulation library for PHP, called Arrayy!

4875.5M16](/packages/voku-arrayy)[voku/stringy

A string manipulation library with multibyte support

1783.8M19](/packages/voku-stringy)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[browner12/helpers

generic helpers

289676.6k7](/packages/browner12-helpers)[pragmarx/ia-arr

Laravel Illuminate Agnostic Arr

553.6M12](/packages/pragmarx-ia-arr)

PHPackages © 2026

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