PHPackages                             redcrystal/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. [Database &amp; ORM](/categories/database)
4. /
5. redcrystal/cast

ActiveLibrary[Database &amp; ORM](/categories/database)

redcrystal/cast
===============

Laravel Value Objects: Cast your Eloquent model attributes to value objects with ease!

v1.0.3(10y ago)2322.9k[1 issues](https://github.com/redcrystalcode/laravel-value-objects/issues)MITPHPPHP &gt;=5.4

Since Nov 23Pushed 10y ago6 watchersCompare

[ Source](https://github.com/redcrystalcode/laravel-value-objects)[ Packagist](https://packagist.org/packages/redcrystal/cast)[ RSS](/packages/redcrystal-cast/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

Laravel Value Objects
---------------------

[](#laravel-value-objects)

[![Build Status](https://camo.githubusercontent.com/ff4343a279e13d26b2955406c0a4f44533972db727a08a0d3a1ede3aa0a0bc88/68747470733a2f2f7472617669732d63692e6f72672f7265646372797374616c636f64652f6c61726176656c2d76616c75652d6f626a656374732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/redcrystal/cast)[![Latest Stable Version](https://camo.githubusercontent.com/7b942c1e07f0832919b8a2f87133ceba9ec5a3975bdfb035754de5e17ff07291/68747470733a2f2f706f7365722e707567782e6f72672f7265646372797374616c2f636173742f76657273696f6e2e706e67)](https://packagist.org/packages/redcrystal/cast)[![Total Downloads](https://camo.githubusercontent.com/90a1d5ef26608d7ef85003c70716401bf0c89063f7d374d72b6b61a3fd85b73a/68747470733a2f2f706f7365722e707567782e6f72672f7265646372797374616c2f636173742f642f746f74616c2e706e67)](https://packagist.org/packages/redcrystal/cast)

Cast your Eloquent model attributes to value objects with ease!

### Requirements

[](#requirements)

This package requires PHP &gt;= 5.4. Using the latest version of PHP is highly recommended. Laravel 4.x and 5.x are supported.

> **Note:** Running tests for this package requires PHP &gt;=5.6.

### Install

[](#install)

Require this package with composer using the following command:

```
composer require redcrystal/cast
```

### Set Up

[](#set-up)

This package lets you easily cast your model attributes to Value Objects that implement our `RedCrystal\Cast\ValueObject` interface. A simple example is provided below.

```
