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.3.0(7mo ago)03.4kMITPHPPHP &gt;=8.1.0

Since Sep 3Pushed 7mo 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 1w ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

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

[](#laravel-casts)

This package provides some additional castable classes for Laravel.

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

[](#requirements)

- PHP 8.1 and above
- Laravel 9, 10, 11 or 12

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

39

—

LowBetter than 86% of packages

Maintenance62

Regular maintenance activity

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Total

4

Last Release

237d ago

### 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 (13 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/events

The Illuminate Events package.

13454.3M1.8k](/packages/illuminate-events)[illuminate/support

The Illuminate Support package.

582107.1M34.5k](/packages/illuminate-support)[illuminate/session

The Illuminate Session package.

9937.4M753](/packages/illuminate-session)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.5M178](/packages/illuminate-broadcasting)[illuminate/redis

The Illuminate Redis package.

8314.0M314](/packages/illuminate-redis)

PHPackages © 2026

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