PHPackages                             balajidharma/laravel-attributes - 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. balajidharma/laravel-attributes

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

balajidharma/laravel-attributes
===============================

A flexible attribute management system for Laravel models

v1.0.7(4mo ago)24.3k—10%12MITPHP

Since Dec 18Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/balajidharma/laravel-attributes)[ Packagist](https://packagist.org/packages/balajidharma/laravel-attributes)[ RSS](/packages/balajidharma-laravel-attributes/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (9)Used By (2)

Laravel Attributes
==================

[](#laravel-attributes)

### A flexible attribute management system for Laravel models.

[](#a-flexible-attribute-management-system-for-laravel-models)

[![Total Downloads](https://camo.githubusercontent.com/366af01af1310af39f1223d61c49657d3256483d23c1f770b92a3e35386ef648/68747470733a2f2f706f7365722e707567782e6f72672f62616c616a69646861726d612f6c61726176656c2d617474726962757465732f646f776e6c6f616473)](https://packagist.org/packages/balajidharma/laravel-attributes)[![Latest Stable Version](https://camo.githubusercontent.com/f6df8806e9442cbae7d6945d4b53b8661c99366b41a7f7021f306babafda1865/68747470733a2f2f706f7365722e707567782e6f72672f62616c616a69646861726d612f6c61726176656c2d617474726962757465732f762f737461626c65)](https://packagist.org/packages/balajidharma/laravel-attributes)[![License](https://camo.githubusercontent.com/4d1c308b15e12a359a70c6f66474d072544f20e6053b654ad02437003341e88c/68747470733a2f2f706f7365722e707567782e6f72672f62616c616a69646861726d612f6c61726176656c2d617474726962757465732f6c6963656e7365)](https://packagist.org/packages/balajidharma/laravel-attributes)

Overview
--------

[](#overview)

Laravel Attributes allows you to add custom attributes to your Laravel models with support for different data types, sorting, and automatic casting.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Save Attrubute](#save-attribute)
- [Get Attributes](#get-attributes)
- [Getting Attribute Casting Values](#getting-attribute-casting-values)
- [Configuration](#configuration-options)
- [Credits](#credits)
- [Demo](#demo)

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

[](#installation)

- Install the package via composer

```
composer require balajidharma/laravel-attributes
```

- Publish the migration with

```
php artisan vendor:publish --provider="BalajiDharma\LaravelAttributes\AttributesServiceProvider" --tag="migrations"
```

- Run the migration

```
php artisan migrate
```

- To Publish the config/attributes.php config file with

```
php artisan vendor:publish --provider="BalajiDharma\LaravelAttributes\AttributesServiceProvider" --tag="config"
```

- Preparing your model To associate views with a model, the model must implement the HasAttributes trait:

```
