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

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

ket-php/utils-truth
===================

Lightweight PHP utility for converting values to boolean without errors.

1.0.1(4mo ago)02MITPHPPHP ^8.1

Since Dec 24Pushed 4mo agoCompare

[ Source](https://github.com/mikhno351/KetPHP-Truth)[ Packagist](https://packagist.org/packages/ket-php/utils-truth)[ Docs](https://github.com/mikhno351/KetPHP-Truth)[ RSS](/packages/ket-php-utils-truth/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

KetSafe
=======

[](#ketsafe)

[![Packagist Version](https://camo.githubusercontent.com/2621ef87aec97b15e6fefe9a2ce9809d59d7b0a3bba86f1125271400ce43669f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b65742d7068702f7574696c732d7472757468)](https://camo.githubusercontent.com/2621ef87aec97b15e6fefe9a2ce9809d59d7b0a3bba86f1125271400ce43669f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b65742d7068702f7574696c732d7472757468)[![Packagist Downloads](https://camo.githubusercontent.com/cfd6d4c4e263cb831c406ad7254309a99284f269e86323c8d7ddf9fb82820aaa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b65742d7068702f7574696c732d74727574683f6c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/cfd6d4c4e263cb831c406ad7254309a99284f269e86323c8d7ddf9fb82820aaa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b65742d7068702f7574696c732d74727574683f6c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)[![Static Badge](https://camo.githubusercontent.com/d70e266076e28598d8ae3aeda67a004e4dc1f764f0d54e97ef142b529889496f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/d70e266076e28598d8ae3aeda67a004e4dc1f764f0d54e97ef142b529889496f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)

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

[](#installation)

Install via Composer:

```
composer require ket-php/utils-truth

```

Usage
-----

[](#usage)

```
use KetPHP\Utils\Truth;

// Non-strict mode (default)
var_dump(Truth::of(1)); // true
var_dump(Truth::of('on')); // true
var_dump(Truth::of('no')); // false
var_dump(Truth::of(null)); // false

// Strict mode
//
// In strict mode, any truthy list is ignored (both global and per-call custom lists). The ONLY values considered true are: 1, '1', true, 'true'
var_dump(Truth::of('true', true)); // true
var_dump(Truth::of('on', true)); // false
var_dump(Truth::of(1, true)); // true
var_dump(Truth::of(0, true)); // false

// Using a callable
var_dump(Truth::of(fn() => 'yes')); // true
var_dump(Truth::of(fn() => 'no')); // false

// Custom truthy list for a single call
$custom = ['foo', 'bar', 123];

var_dump(Truth::of('foo', false, $custom)); // true
var_dump(Truth::of('baz', false, $custom)); // false

// Configure global truthy values
Truth::configure(['sure', 'ok']);

var_dump(Truth::of('ok')); // true
var_dump(Truth::of('yes')); // false (old default removed)
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance74

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

Total

2

Last Release

145d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60658acba7d28aa03d830e4708d37a7d0d797db2669bbb2e8ae0fff563df4e3e?d=identicon)[mikhno351](/maintainers/mikhno351)

---

Top Contributors

[![mikhno351](https://avatars.githubusercontent.com/u/57302726?v=4)](https://github.com/mikhno351 "mikhno351 (2 commits)")

---

Tags

phputilityhelpersbooleanketphpket-phptruthy

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[brandonwamboldt/utilphp

util.php is a collection of useful functions and snippets that you need or could use every day, designed to avoid conflicts with existing projects

1.0k538.8k12](/packages/brandonwamboldt-utilphp)[transprime-research/piper

PHP Pipe method execution with values from chained method executions

174.6k2](/packages/transprime-research-piper)

PHPackages © 2026

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