PHPackages                             lambdatt-php/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. lambdatt-php/utils

ActiveSplitphp-module[Utility &amp; Helpers](/categories/utility)

lambdatt-php/utils
==================

A SplitPHP Framework plugin which provides helpers and general utilities out of the box.

v0.1.7(4mo ago)028MITPHP

Since Jun 19Pushed 4mo agoCompare

[ Source](https://github.com/LambdaTT/utils)[ Packagist](https://packagist.org/packages/lambdatt-php/utils)[ RSS](/packages/lambdatt-php-utils/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (9)Used By (0)

lambdatt-php/utils
==================

[](#lambdatt-phputils)

A SplitPHP Framework plugin which provides helpers and general utilities out of the box.

---

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

[](#installation)

Install via Composer:

```
composer require lambdatt-php/utils
```

Run the Migrations:

```
php console migrations:apply --module=utils
```

**PS: this can only be installed on a SplitPHP Framework project. For more information refer to: **

Included Utilities
------------------

[](#included-utilities)

- General purpose procedures
- Service "utils/mail": provides a ready-to-use mailer.
- Service "utils/misc": a service with several general purpose utilities.

Usage:
------

[](#usage)

### General Purpose Procedures:

[](#general-purpose-procedures)

- **generate\_dateseries:***(inside a service, CLI or webservice)*

```
// returns a list of dates (YYYY-mm-dd) between $startDate and $endDate
$this->getDao('tablename')
    ->generate_dateseries($startDate, $endDate)
    ->find("SELECT * FROM dateseries");
```

---

### Service "utils/mail":

[](#service-utilsmail)

**Configs:**Set in your environment the following variables:

```
# SMTP SETTINGS:
SMTP_HOST="your-smtp-host.address"
SMTP_PORT=587 # your smtp port (587) is the most commonly used for TLS
REQUIRE_TLS="on" # or 'off'
SMTP_USER="your_smtp_username"
SMTP_PASS="your_smtp_user_password"
SENDER_EMAIL="sender@your-domain.com"
SENDER_NAME="Sender Name"
```

**Send e-mail:**

```
$this->getService('utils/mail')->send($msg, $recipientAddress, $subject);
```

---

### Service utils/misc:

[](#service-utilsmisc)

This service is a miscelanea of functions for many purposes. heres a list of the available functions:

- `matrixUnique($matrix, $innerObj = false)`: Removes duplicate entries from a two-dimensional array ($matrix) by serializing each sub-array. If $innerObj is true, unserialized elements become objects; otherwise, they remain arrays.
- `validateCPF($cpf)`: Takes a string CPF and returns true if it’s a valid Brazilian CPF (11 digits, not a repeated sequence, correct check digits), or false otherwise.
- `validateCNPJ($cnpj)`: Takes a string CNPJ and returns true if it’s a valid Brazilian CNPJ (14 digits, not a repeated sequence, correct check digits), or false otherwise.
- `validateUF($data)`: Accepts a Brazilian state abbreviation (e.g. "SP") and returns true if it’s one of the 27 valid UFs, or false otherwise.
- `getUserIP()`: No parameters. Returns the client’s IP address, checking HTTP\_CLIENT\_IP, then HTTP\_X\_FORWARDED\_FOR, then REMOTE\_ADDR.
- `stringToSlug(string $string)`: Cleans up an input string to a URL-friendly slug: removes special characters, transliterates to ASCII, replaces spaces with hyphens, and lowercases everything.
- `dataBlackList($data, array $blacklist)`: Takes an array or object ($data) and a list of forbidden keys ($blacklist); returns an array with those keys removed.
- `dataWhiteList($data, array $whitelist)`: Takes an array or object ($data) and a list of allowed keys ($whitelist); returns an array containing only those keys.
- `dumpToXLS($data, $fileName = "data_dump.xls")`: Sends HTTP headers for downloading an Excel file and echoes $data (array of arrays or objects) as tab-delimited rows, then exits.
- `secondsToTime($secs)`: Converts a total number of seconds ($secs) into an object with integer properties

    ```
    {
        h: hours
        m: minutes
        s: seconds
    }
    ```
- `readCsvFile($filename)`: Reads a CSV file at path $filename, throwing an Exception if it doesn’t exist or isn’t readable. Returns an array of objects, using the first row as column headers.
- `readCsvFromString($csvString)`: Parses CSV data from a string ($csvString) and returns an array of objects, using the first line as headers.
- `generateCPF($onlyNumbers = false)`: Generates a random CPF. If $onlyNumbers is true, returns only digits; otherwise, returns formatted as ###.###.###-##.
- `generateRG($onlyNumbers = false)`: Generates a random RG (9 digits). If $onlyNumbers is true, returns only digits; otherwise, returns formatted as ##.###.###-#.
- `share($name, $value = null)`: If $value is provided, stores it in a static cache under key $name; if not, returns the previously stored value or null if none exists.
- `formatAddress($addressObj)`: Accepts an object with address fields (e.g. ds\_addressstreet, ds\_addressnumber, etc.), verifies required fields are present and non-empty, and returns a single formatted string (Street, Number, \[Complement,\] Neighborhood, City – UF) or null if any required field is missing.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance75

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

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

Every ~28 days

Recently: every ~44 days

Total

8

Last Release

135d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a93073c7a216d7543dd3e833d3a1f1f73ec7df743fd2474cc239702d4b50bacb?d=identicon)[gabriel-guelfi](/maintainers/gabriel-guelfi)

---

Top Contributors

[![gabriel-guelfi](https://avatars.githubusercontent.com/u/6461967?v=4)](https://github.com/gabriel-guelfi "gabriel-guelfi (18 commits)")

### Embed Badge

![Health badge](/badges/lambdatt-php-utils/health.svg)

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

PHPackages © 2026

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