PHPackages                             rawilk/laravel-casters - 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. rawilk/laravel-casters

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

rawilk/laravel-casters
======================

A collection of custom casts for Laravel.

v3.1.1(1y ago)65.6k↓27.1%[2 PRs](https://github.com/rawilk/laravel-casters/pulls)1MITPHPPHP ^8.1|^8.2|^8.3|^8.4CI passing

Since Sep 18Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/rawilk/laravel-casters)[ Packagist](https://packagist.org/packages/rawilk/laravel-casters)[ Docs](https://github.com/rawilk/laravel-casters)[ GitHub Sponsors](https://github.com/rawilk)[ RSS](/packages/rawilk-laravel-casters/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (17)Used By (1)

Casts for Laravel
=================

[](#casts-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d07ab5a297402f73c66b6b4f07d5371b06c944685e7d49f061f77d39e475c10a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726177696c6b2f6c61726176656c2d636173746572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rawilk/laravel-casters)[![Tests](https://github.com/rawilk/laravel-casters/workflows/Tests/badge.svg?style=flat-square)](https://github.com/rawilk/laravel-casters/workflows/Tests/badge.svg?style=flat-square)[![Total Downloads](https://camo.githubusercontent.com/22573ed145af336d8df189d214c5c376246a4fa2dc0f61dd3c3aafa7426477f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726177696c6b2f6c61726176656c2d636173746572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rawilk/laravel-casters)[![PHP from Packagist](https://camo.githubusercontent.com/5031d21a11ae7cbf622ffdab5a30bac2a38fedd0d034774908f3a13ceb28e6f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726177696c6b2f6c61726176656c2d636173746572733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rawilk/laravel-casters)[![License](https://camo.githubusercontent.com/6bcba8032c1dbccc9f2c16715c36d91b3b2dff4e54f23cb9210cc2acc43f361b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726177696c6b2f6c61726176656c2d636173746572733f7374796c653d666c61742d737175617265)](https://github.com/rawilk/laravel-casters/blob/main/LICENSE.md)

[![Social image](https://camo.githubusercontent.com/e53591569e1e4d6ef71cd77da1054cf2ed08cb661ad41e97552df87b7d7ec935/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4361737473253230666f722532304c61726176656c2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d726177696c6b2532466c61726176656c2d63617374657273267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d412b636f6c6c656374696f6e2b6f662b637573746f6d2b63617374732b666f722b4c61726176656c2e266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d636865636b)](https://camo.githubusercontent.com/e53591569e1e4d6ef71cd77da1054cf2ed08cb661ad41e97552df87b7d7ec935/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4361737473253230666f722532304c61726176656c2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d726177696c6b2532466c61726176656c2d63617374657273267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d412b636f6c6c656374696f6e2b6f662b637573746f6d2b63617374732b666f722b4c61726176656c2e266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d636865636b)

Casts for Laravel is a collection of custom class casts for Laravel Eloquent Models. This package allows you to quickly and easily add casts for names and hashing passwords on your user models.

```
protected $casts = [
    // Hashes the value when assigning to `$model->password`.
    // Note: Password cast is now deprecated. Use Laravel's hash cast instead.
    'password' => Password::class,

    // Provides utilities for manipulating a name
    'name' => Name::class,
];
```

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

[](#installation)

You can install the package via composer:

```
composer require rawilk/laravel-casters
```

Documentation
-------------

[](#documentation)

For documentation, please refer to:

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security
--------

[](#security)

Please review [my security policy](.github/SECURITY.md) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Randall Wilk](https://github.com/rawilk)
- [All Contributors](../../contributors)

Alternatives
------------

[](#alternatives)

Some alternatives to this package include:

- [crudly/encrypted](https://github.com/Crudly/Encrypted)
- [watson/nameable](https://github.com/dwightwatson/nameable)

Disclaimer
----------

[](#disclaimer)

This package is not affiliated with, maintained, authorized, endorsed or sponsored by Laravel or any of its affiliates.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance61

Regular maintenance activity

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 70.3% 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 ~124 days

Recently: every ~164 days

Total

14

Last Release

447d ago

Major Versions

1.0.1 → 2.0.02020-11-12

v2.0.2 → v3.0.02022-11-01

v1.x-dev → v3.0.22023-05-11

PHP version history (7 changes)1.0.0PHP ^7.4

2.0.0PHP ^7.4|^8.0

v2.0.1PHP ^7.4|^8.0|^8.1

v3.0.0PHP ^8.1

v3.0.1PHP ^8.1|^8.2

v3.0.4PHP ^8.1|^8.2|^8.3

v3.1.1PHP ^8.1|^8.2|^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e2f599d4d290bbb514a933d4f21c3f18fb093f5f8a9994cb17f5469853c749c?d=identicon)[rawilk](/maintainers/rawilk)

---

Top Contributors

[![rawilk](https://avatars.githubusercontent.com/u/22842525?v=4)](https://github.com/rawilk "rawilk (109 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (27 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (19 commits)")

---

Tags

castencrypter-castpassword-castrawilkcustom-castslaravel-casterspassword castname cast

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/rawilk-laravel-casters/health.svg)

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

###  Alternatives

[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[illuminate/broadcasting

The Illuminate Broadcasting package.

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

The Illuminate Redis package.

8314.0M314](/packages/illuminate-redis)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)

PHPackages © 2026

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