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

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

propaysystems/utilities
=======================

A set of helper utilities and traits

1.0.16(5mo ago)04.5k↓32.8%[1 PRs](https://github.com/PropaySystems/utilities/pulls)MITPHPPHP ^8.2|^8.3|^8.4|^8.5CI failing

Since Nov 17Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/PropaySystems/utilities)[ Packagist](https://packagist.org/packages/propaysystems/utilities)[ Docs](https://github.com/propaysystems/utilities)[ RSS](/packages/propaysystems-utilities/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (22)Used By (0)

[![Propay Systems](https://camo.githubusercontent.com/4d22272ed2b292c212db665ef80e9334935a231510c600a34923a81d1af460f4/68747470733a2f2f6433323478346577337936746e6e2e636c6f756466726f6e742e6e65742f7061636b616765732f62616e6e6572732f70726f70617973797374656d732d7574696c69746965732e706e67)](https://camo.githubusercontent.com/4d22272ed2b292c212db665ef80e9334935a231510c600a34923a81d1af460f4/68747470733a2f2f6433323478346577337936746e6e2e636c6f756466726f6e742e6e65742f7061636b616765732f62616e6e6572732f70726f70617973797374656d732d7574696c69746965732e706e67)

Propay Utilities
================

[](#propay-utilities)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0faabc63a68ddd011fe19245d1c8fa3918dc8a7a4a2087ae73392861c26e7135/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70726f70617973797374656d732f7574696c69746965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/propaysystems/utilities)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0f0d3a4530923217a6fab9c2936b3dd69c8a8cebab860a101a169cbbdc540b39/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70726f70617973797374656d732f7574696c69746965732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/propaysystems/utilities/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/90e4937d86bb0bb9b642212f58e850784aa6e3e8261562dcf1cb2f62ce16419c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70726f70617973797374656d732f7574696c69746965732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/propaysystems/utilities/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/58330e9ff91d35f477d1a9084318c4d7beaa028cbd54e32c36b1f3b112ae2dc8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70726f70617973797374656d732f7574696c69746965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/propaysystems/utilities)

A set of helper utilities and traits to common functions we use everyday and across all our systems.

Requirements
------------

[](#requirements)

PHP 8.1+
Laravel 9+

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

[](#installation)

You can install the package via composer:

```
composer require propaysystems/utilities
```

You can publish the config file with:

```
php artisan vendor:publish --tag="utilities-config"
```

Features
--------

[](#features)

Helpers
-------

[](#helpers)

### -- Database Helper --

[](#---database-helper---)

Clears all data and reset auto increment on given table.

```
DatabaseHelper::resetTable($table);
```

### -- Date Helper --

[](#---date-helper---)

This will get the month name of the month number you pass in. Abbreviation will return the short name of the month.

```
DateHelper::getMonthName($number, $abbreviation = false);
```

Get current financial year of South Africa

```
DateHelper::getFiscalYear();
```

Get time

```
DateHelper::getTime($string);
```

### -- File Helper --

[](#---file-helper---)

This will get the human-readable format of the bytes you pass in

```
FileHelper::formatBytes($bytes, $precision = 2);
```

### -- Http Helper --

[](#---http-helper---)

Get the currently assigned public ip address of the request

```
HttpHelper::getIp();
```

Get the currently useragent of the request

```
HttpHelper::getUserAgent();
```

Get the hostname/domain name of the system. You can specify full to return http::// parts aswell

```
HttpHelper::hostname($full = false);
```

Get the subdomain of the current system

```
HttpHelper::subdomain();
```

### -- Id Number Helper --

[](#---id-number-helper---)

Generate a fake id number for testing from the date of birth

```
IdNumberHelper::generateIdNumber($dateOfBirt, int $male = 1);
```

Generate a complete fake id number for testing

```
IdNumberHelper::generateFakeNumber($dateOfBirt, int $male = 1);
```

Get gender from the id number

```
IdNumberHelper::getGenderCode($idNumber);
```

Get the date of birth from the id number

```
IdNumberHelper::getBirthDate($idNumber);
```

Get age from the id number

```
IdNumberHelper::getAgeFromIdNumber($idNumber);
```

Validate the id number

```
IdNumberHelper::getAgeFromIdNumber($attribute, $value, $parameters);
```

### -- Number Helper --

[](#---number-helper---)

Will generate a random integer between 1 and 100 000

```
NumberHelper::randomInt();
```

Will get the % difference between 2 number

```
NumberHelper::getPercentageDifference(int $last, int $current);
```

This will format the number accordingly 100000 will become 100.00k

```
NumberHelper::numberFormat(int $number);
```

This will combine a country prefix ex: 27 with the cell number ex: 0821231234 and return 27821231234

```
NumberHelper::combineCellPrefix($prefix, $number)
```

### -- Route Helper --

[](#---route-helper---)

Check of the string is in the current route name

```
RouteHelper::currentRouteContains($string);
```

### -- SMS Helper --

[](#---sms-helper---)

Get the number of sms messages from the string

```
SmsHelper::multipart_count($str);
```

### -- Spatie Media Helper --

[](#---spatie-media-helper---)

Helper functions related to the spatie media package for managing files

### -- String Helper --

[](#---string-helper---)

This will get the first character of each word and capitalise them and only return first letter/s

```
StringHelper::initials($str, bool $upperCase = true);
```

This will capitalise first character of each word and return the string

```
StringHelper::capitaliseFirstChar($string);
```

Removed all white spaces and special characters

```
StringHelper::clean($string, string $delimiter = '-', bool $toLower = false, bool $removeSpecialChars = true);
```

This will generate a random password

```
StringHelper::generatePassword($length = 15, $count = 1, $characters = 'lower_case,upper_case,numbers,special_symbols');
```

This will mask a string with relevant characters

```
StringHelper::mask($string, string $maskingCharacter = '*', int $padLeft = 4, int $padRight = 4));
```

Transform db column name to human-readable

```
StringHelper::dbColumnHumanReadable($string_array);
```

Transform db column name to human-readable relation

```
StringHelper::dbColumnRelation($string_array);
```

Return a list of all special characters

```
StringHelper::specialCharacters();
```

Traits
------

[](#traits)

Include these traits in any of your classes

### -- Activity Helper Trait --

[](#---activity-helper-trait---)

This is a helper function to the spatie activity log package

```
use ActivityHelper;

$thia->log(string $channel, string $description, $preformedOn = null, $causedBy = null, array $properties = []);
```

### -- TableHelper Trait --

[](#---tablehelper-trait---)

This is a helper for the WireUI notifications to easily fire a notification from any livewire class.

```
use AlertHelper;

$this->alert($title, $text...);
$this->alertUpdated();
$this->alertCreated();
$this->alertDeleted();
etc
```

### -- Dropdown Schema Trait --

[](#---dropdown-schema-trait---)

Use the trait in your database models instead of having to write the boilerplate code multiple times

```
use DropdownSchema;

$this->table('categories');
```

### -- Composite Primary Key Trait --

[](#---composite-primary-key-trait---)

Use the trait in your database models to allow access to composite primary keys

```
use HasCompositePrimaryKey;

$this->find($ids, $columns = ['*']);
$this->setKeysForSaveQuery($query);
```

### -- Password Strength Trait --

[](#---password-strength-trait---)

Us this trait for password strength progress bar.

```
use PasswordStrength;
```

### -- Password Validation Trait --

[](#---password-validation-trait---)

Us this trait for standard password validation.

```
use PasswordValidationRules;
```

### -- Save to uppercase Trait --

[](#---save-to-uppercase-trait---)

This will fave all your model data to uppercase

```
use SaveToUpper;
```

### -- Set null on empty Trait --

[](#---set-null-on-empty-trait---)

This will force all empty string to be null instead of empty

```
use SetNullOnEmpty;

$this->setNullOnEmpty($input);
```

### -- Toggle triggers Trait --

[](#---toggle-triggers-trait---)

This will toggle enable or disable triggers in the relevant database table

```
use TriggerHelper;

$this->switchDatabaseTrigger($enable = true, $table = null, $trigger = null, string $connection = 'sqlsrv');
```

### -- TableHelper Trait --

[](#---tablehelper-trait----1)

This is a helper for the livewire powergrid package on for the pagination.

```
use TableHelper;
```

Testing
-------

[](#testing)

Run pest testing

```
composer test
```

Run phpstan code analysis

```
composer analyse
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ettienne Louw](https://github.com/PropaySystems)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance70

Regular maintenance activity

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 76.7% 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 ~43 days

Recently: every ~107 days

Total

18

Last Release

175d ago

Major Versions

v0.0.1 → v1.0.02023-11-17

PHP version history (3 changes)v0.0.1PHP ^8.1

v1.0.13PHP ^8.2

1.0.16PHP ^8.2|^8.3|^8.4|^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb26ac16f482619121698ff934f7757be3613df54d11a00c6917a278bb696332?d=identicon)[propay](/maintainers/propay)

---

Top Contributors

[![ettiennelouw](https://avatars.githubusercontent.com/u/1754421?v=4)](https://github.com/ettiennelouw "ettiennelouw (66 commits)")[![mariusdatakrag](https://avatars.githubusercontent.com/u/81690364?v=4)](https://github.com/mariusdatakrag "mariusdatakrag (14 commits)")[![JCDuvenage](https://avatars.githubusercontent.com/u/167092089?v=4)](https://github.com/JCDuvenage "JCDuvenage (3 commits)")[![MickProPay](https://avatars.githubusercontent.com/u/98587629?v=4)](https://github.com/MickProPay "MickProPay (3 commits)")

---

Tags

laravelutilitiesPropaySystems

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.8k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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