PHPackages                             live-controls/utils - 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. live-controls/utils

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

live-controls/utils
===================

Utils package for live-controls

v2.1.0(1mo ago)02.4k↓83.3%4PHP

Since Jul 22Pushed 3mo agoCompare

[ Source](https://github.com/live-controls/utils)[ Packagist](https://packagist.org/packages/live-controls/utils)[ RSS](/packages/live-controls-utils/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (7)Versions (73)Used By (4)

Utils Package for LiveControls
==============================

[](#utils-package-for-livecontrols)

[![Release Version](https://camo.githubusercontent.com/c09ba08fcd9f837535bc755414293b5b446f152f4042c948ab06c03bfd8972bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6976652d636f6e74726f6c732f7574696c73)](https://camo.githubusercontent.com/c09ba08fcd9f837535bc755414293b5b446f152f4042c948ab06c03bfd8972bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6976652d636f6e74726f6c732f7574696c73)[![Packagist Version](https://camo.githubusercontent.com/d8e4449cf161bce61fbce55cd24b53b2cd8e8ab9f15c417707ddec364b177925/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6976652d636f6e74726f6c732f7574696c733f636f6c6f723d253233303037353030)](https://camo.githubusercontent.com/d8e4449cf161bce61fbce55cd24b53b2cd8e8ab9f15c417707ddec364b177925/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6976652d636f6e74726f6c732f7574696c733f636f6c6f723d253233303037353030)

An utilities package for Laravel 11+, it includes various categories of useful methods to ease the life of a developer and speed up the process.

**To use the old system with a single Utils class, use the versions v1.x or use the v1 branch**

Classes
-------

[](#classes)

### AB

[](#ab)

An easy way to make AB tests based on variants.

#### getVariantForModel

[](#getvariantformodel)

Gets the variant for the model (Either 1 or 2) based on their primaryKey. Use the salt to have different outcomes for different tests

Example:

```
$model = \App\Models\User::find(1);

$variant = \LiveControls\Utils\AB::getVariantForModel($model, 'feature_a');

dd($variant); //Returns either 1 or 2
```

#### hasVariant

[](#hasvariant)

Check if the Model is inside the selected variant based on their primaryKey. Use the salt to have different outcomes for different tests

Example:

```
$variant = 1; //Can also be A or 2/B
$model = \App\Models\User::find(1);

$hasVariant = hasVariant($model, $variant, 'feature_a');

dd($hasVariant); //Would return true if model is inside variant with the selected salt
```

### Arrays

[](#arrays)

An array helper to add some functions that are present in Laravel collections, but not in PHP arrays and more.

### BBCodes

[](#bbcodes)

Contains helpers to convert BBCodes.

### Blogging

[](#blogging)

Contains helpers to make it easier for creating blogs.

### CSV

[](#csv)

Contains methods to handle CSV files like import, export and more.

### Files

[](#files)

Contains helpers to handle Files like get their Mimetypes and more.

### Numbers

[](#numbers)

Contains helpers to handle numbers with ease.

### Others

[](#others)

Several methods that do not fit into other categories.

### SocialSecurity

[](#socialsecurity)

Contains helpers to handle brazilian social security numbers.

### Str

[](#str)

Contains helpers to manipulate strings.

### Time

[](#time)

Contains helpers to Carbon time objects and more.

Enums
-----

[](#enums)

#### SocialSecurityNumberTypes

[](#socialsecuritynumbertypes)

Contains several types of brazilian social security numbers to ease their check and manipulation. Is used by the SocialSecurity class.

Exceptions
----------

[](#exceptions)

#### DeprecatedException

[](#deprecatedexception)

An exception that can be used in testing to show deprecated methods.

#### NotImplementedException

[](#notimplementedexception)

An exception that can be used to show not implemented methods.

Traits
------

[](#traits)

#### HasABTests

[](#hasabtests)

A trait that will handle AB tests for Laravel models.

In your Model add the following:

```
use \LiveControls\Utils\HasABTests;
```

You can then use it the following:

```
$model = \App\Models\User::find(1);
$variant = 1; //Can be either 1/A or 2/B
$salt = 'feature_1'; //Can be a name of the feature you want to check or can be leave out to have it general.
$model->hasVariant($variant, $salt); //Will return true if its the models variant

$model->getVariantForModel($salt); //Returns either 1 or 2, depending on the models variant.
$model->has_variant_a; //Returns true if model has variant a. Does not support a salt.
$model->has_variant_b; //Returns true if model has variant b. Does not support a salt.
```

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance83

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

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

Total

72

Last Release

53d ago

Major Versions

v1.x-dev → v2.0.02026-06-14

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/60240491?v=4)[Roman Wanner](/maintainers/daredloco)[@daredloco](https://github.com/daredloco)

---

Top Contributors

[![daredloco](https://avatars.githubusercontent.com/u/60240491?v=4)](https://github.com/daredloco "daredloco (83 commits)")

###  Code Quality

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/live-controls-utils/health.svg)

```
[![Health](https://phpackages.com/badges/live-controls-utils/health.svg)](https://phpackages.com/packages/live-controls-utils)
```

###  Alternatives

[maxmind/geoip

MaxMind GeoIP Symfony2 Bundle

271.3M1](/packages/maxmind-geoip)[theodorejb/polycast

Safely cast values to int, float, or string

50266.2k1](/packages/theodorejb-polycast)[llm/mcp-server

PHP SDK for building MCP servers

451.4k](/packages/llm-mcp-server)

PHPackages © 2026

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