PHPackages                             yii1tech/model-typecast - 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. yii1tech/model-typecast

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

yii1tech/model-typecast
=======================

Allows typecast for Model and ActiveRecord attributes in Yii1

1.0.0(2y ago)13.3k↑30.4%BSD-3-ClausePHPPHP &gt;=7.1

Since Dec 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/yii1tech/model-typecast)[ Packagist](https://packagist.org/packages/yii1tech/model-typecast)[ GitHub Sponsors](https://github.com/klimov-paul)[ Patreon](https://www.patreon.com/klimov_paul)[ RSS](/packages/yii1tech-model-typecast/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (2)Used By (0)

 [ ![](https://avatars.githubusercontent.com/u/134691944) ](https://github.com/yii1tech)

Model Attributes Typecast Extension for Yii 1
=============================================

[](#model-attributes-typecast-extension-for-yii-1)

This extension provides support for Yii1 Model and ActiveRecord attributes typecast.

For license information check the [LICENSE](LICENSE.md)-file.

[![Latest Stable Version](https://camo.githubusercontent.com/3a5c4630f2a01b3a8f75ced53073ec1aaa5a4a747c656ac44d4c246aab63d6c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79696931746563682f6d6f64656c2d74797065636173742e737667)](https://packagist.org/packages/yii1tech/model-typecast)[![Total Downloads](https://camo.githubusercontent.com/8c0da6a99485019bc4c1af7de75614fe909264083d9aab76380c4614c4705c74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79696931746563682f6d6f64656c2d74797065636173742e737667)](https://packagist.org/packages/yii1tech/model-typecast)[![Build Status](https://github.com/yii1tech/model-typecast/workflows/build/badge.svg)](https://github.com/yii1tech/model-typecast/actions)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist yii1tech/model-typecast

```

or add

```
"yii1tech/model-typecast": "*"
```

to the "require" section of your composer.json.

Usage
-----

[](#usage)

This extension provides support for Yii1 Model and ActiveRecord automatic attributes typecast. It is performed via usage of `\yii1tech\model\typecast\TypecastBehavior` behavior. It should be attached to `\CModel` or `\CActiveRecord` descendant. For example:

```
