PHPackages                             asgard/entity - 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. asgard/entity

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

asgard/entity
=============

v0.3.1(10y ago)39435MITPHPPHP &gt;=5.5.9

Since Sep 9Pushed 8y agoCompare

[ Source](https://github.com/asgardphp/entity)[ Packagist](https://packagist.org/packages/asgard/entity)[ RSS](/packages/asgard-entity/feed)WikiDiscussions master Synced 1mo ago

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

\#Entities

[![Build Status](https://camo.githubusercontent.com/7f802900022c2b3b0470742515586a33ca652fe0f24d03b3bf90d4f478891170/68747470733a2f2f7472617669732d63692e6f72672f6173676172647068702f656e746974792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/asgardphp/entity)

Entities are elements that represent your data. Some frameworks call them models, but they are similar, although entities don't deal themselves directly with the database. They should always be stored in the Entities folder of a bundle.

- [Installation](#installation)
- [Instance](#instance)
- [Definition](#definition)
- [Properties](#properties)
- [Multiple values per property](#multiple)
- [Property hooks](#hooks)
- [Validation](#validation)
- [Behaviors](#behaviors)
- [I18N](#i18n)
- [Serialization](#serialization)
- [Old/New](#oldnew)

\##Installation **If you are working on an Asgard project you don't need to install this library as it is already part of the standard libraries.**

```
composer require asgard/entity 0.*

```

\##Instance

An entity is instantiated like:

```
$article = new Article;

```

You can also pass default values:

```
$article = new Article(['title'=>'hello!']);

```

\##Definition

An entity is defined by a class:

```
