baibaratsky/yii2-serialized-attributes-behavior

Yii2 Serialized Attributes Behavior

Maintainers

👁 baibaratsky

Package info

github.com/baibaratsky/yii2-serialized-attributes-behavior

Homepage

Type:yii2-extension

pkg:composer/baibaratsky/yii2-serialized-attributes-behavior

Statistics

Installs: 75 529

Dependents: 9

Suggesters: 0

Stars: 11

Open Issues: 1

v1.2.0 2016-08-18 20:25 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

BSD-3-Clause f4a956d8a9f3751228e075078063a038111261ab

  • Andrei Baibaratsky <andrei.woop@baibaratsky.com>

serializearrayBehaviorattributeattributesyiiyii2serialized

This package is auto-updated.

Last update: 2026-06-16 18:05:22 UTC


README

This Yii2 model behavior allows you to store arrays in attributes. To attach the behavior put the following code in your model:

 public function behaviors()
 	{
 		return [
 			'serializedAttributes' => [
 				'class' => SerializedAttributes::className(),
 				
 				// Define the attributes you want to be serialized
 'attributes' => ['serializedData', 'moreSerializedData'],
 
 // Enable this option if your DB is not in UTF-8
 // (more info at http://www.jackreichert.com/2014/02/02/handling-a-php-unserialize-offset-error/)
 // 'encode' => true,
 			],
 		];
 	}