PHPackages                             bbprojectnet/laravel-casts - 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. bbprojectnet/laravel-casts

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

bbprojectnet/laravel-casts
==========================

Additional casts classes for Laravel.

1.4.0(1w ago)03.5kMITPHPPHP &gt;=8.3.0

Since Sep 3Pushed 1w ago1 watchersCompare

[ Source](https://github.com/bbprojectnet/laravel-casts)[ Packagist](https://packagist.org/packages/bbprojectnet/laravel-casts)[ RSS](/packages/bbprojectnet-laravel-casts/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (10)Versions (6)Used By (0)

Laravel casts
=============

[](#laravel-casts)

This package provides some additional castable classes for Laravel.

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

[](#requirements)

- PHP 8.3 and above
- Laravel 13

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

[](#installation)

Require this package with composer using the following command:

```
composer require bbprojectnet/laravel-casts
```

Casts
-----

[](#casts)

### AsEnumArray

[](#asenumarray)

Casts a value (json) to a array of Enums.

```
protected $casts = [
	'roles' => AsEnumArray::class . ':' . Role::class,
];
```

### AsEnumCollection

[](#asenumcollection)

Casts a value (json) to a Laravel Collection of Enums.

```
protected $casts = [
	'roles' => AsEnumCollection::class . ':' . Role::class,
];
```

### AsHash

[](#ashash)

Saves the value as a hash using the Laravel Hash facade. As of Laravel 10, same as `hashed` cast.

```
protected $casts = [
	'password' => AsHash::class,
];
```

### AsInterval

[](#asinterval)

Casts a seconds value (integer) as a CarbonInterval class.

```
protected $casts = [
	'timeout' => AsInterval::class,
];
```

### AsStrictArray

[](#asstrictarray)

Same as `array`, except that a `null` value is cast to an empty array. Similarly, an empty array is stored in the database as `null`.

```
protected $casts = [
	'items' => AsStrictArray::class,
];
```

### AsTimeZone

[](#astimezone)

Cast a value (string) as a DateTimeZone class.

```
protected $casts = [
	'timezone' => AsTimeZone::class,
];
```

License
-------

[](#license)

The Laravel casts package is open-sourced software licensed under the MIT license.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance98

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Total

5

Last Release

10d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.1.0

1.4.0PHP &gt;=8.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/675fcdb8ca5581ded26155cdd2821dbfd7300fa790d1a7acc66f2d02a3b0fb24?d=identicon)[bbprojectnet](/maintainers/bbprojectnet)

---

Top Contributors

[![bbprojectnet](https://avatars.githubusercontent.com/u/1136309?v=4)](https://github.com/bbprojectnet "bbprojectnet (14 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bbprojectnet-laravel-casts/health.svg)

```
[![Health](https://phpackages.com/badges/bbprojectnet-laravel-casts/health.svg)](https://phpackages.com/packages/bbprojectnet-laravel-casts)
```

###  Alternatives

[illuminate/queue

The Illuminate Queue package.

20433.0M1.8k](/packages/illuminate-queue)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[illuminate/filesystem

The Illuminate Filesystem package.

16166.4M3.5k](/packages/illuminate-filesystem)[illuminate/events

The Illuminate Events package.

13558.0M2.3k](/packages/illuminate-events)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)[illuminate/pagination

The Illuminate Pagination package.

12234.6M1.1k](/packages/illuminate-pagination)

PHPackages © 2026

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