PHPackages                             withinboredom/null-cast - 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. withinboredom/null-cast

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

withinboredom/null-cast
=======================

Casting, but with null!

v1.0.0(2y ago)02MITPHPPHP &gt;=8.1

Since Jan 27Pushed 2y ago1 watchersCompare

[ Source](https://github.com/withinboredom/null-cast)[ Packagist](https://packagist.org/packages/withinboredom/null-cast)[ RSS](/packages/withinboredom-null-cast/feed)WikiDiscussions main Synced 1mo ago

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

Null Cast
=========

[](#null-cast)

When using strict types, `null` is often erased when casting, introducing subtle bugs. This library allows you to replace your casts with these simple functions that retain `null`, but otherwise perform the desired cast.

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

[](#installation)

```
composer require withinboredom/null-cast

```

Usage
-----

[](#usage)

```
use function Withinboredom\NullCast\boolval;
use function Withinboredom\NullCast\floatval;
use function Withinboredom\NullCast\intval;
use function Withinboredom\NullCast\stringval;

boolval('true') === true;
boolval(null) === null;

floatval('12.34') === 12.34;
floatval(null) === null;

intval(true) === 1;
intval(null) === null;

stringval(123) === '123';
stringval(null) === null;
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Unknown

Total

1

Last Release

842d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f5995953815a492e3bf6276044042d84035247139141ec7fd013c13af4e6dd4?d=identicon)[withinboredom](/maintainers/withinboredom)

---

Top Contributors

[![withinboredom](https://avatars.githubusercontent.com/u/1883296?v=4)](https://github.com/withinboredom "withinboredom (3 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/withinboredom-null-cast/health.svg)

```
[![Health](https://phpackages.com/badges/withinboredom-null-cast/health.svg)](https://phpackages.com/packages/withinboredom-null-cast)
```

###  Alternatives

[bassjobsen/bootstrap-3-typeahead

Bootstrap 3 Typeahead

1.7k272.5k4](/packages/bassjobsen-bootstrap-3-typeahead)[cornford/googlmapper

An easy way to integrate Google Maps with Laravel.

457447.9k4](/packages/cornford-googlmapper)[garoevans/php-enum

Convenient way to always have an Enum object available and utilise Spl Types if available.

19158.8k5](/packages/garoevans-php-enum)[rabbit-converter/rabbit-php

Another Zawgyi &lt;=&gt; Unicode Converter

2913.6k](/packages/rabbit-converter-rabbit-php)

PHPackages © 2026

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