PHPackages                             imliam/yii2-traits - 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. imliam/yii2-traits

ActiveLibrary

imliam/yii2-traits
==================

A collection of miscellaneous traits to extend parts of Yii2

v1.0.0(7y ago)07MITPHPPHP ^7.1

Since Jul 22Pushed 7y ago1 watchersCompare

[ Source](https://github.com/ImLiam/yii2-traits)[ Packagist](https://packagist.org/packages/imliam/yii2-traits)[ Docs](https://github.com/imliam/yii2-traits)[ RSS](/packages/imliam-yii2-traits/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Yii2 Traits
===========

[](#yii2-traits)

[![Latest Version on Packagist](https://camo.githubusercontent.com/86dad4031bd7eabeaddff1c960e92900c6c0b5cb1710991b4e1dec9af55d68c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d6c69616d2f796969322d7472616974732e737667)](https://packagist.org/packages/imliam/yii2-traits)[![Total Downloads](https://camo.githubusercontent.com/93aee14594fc6e334c5aedc62ccec55569d72b706abaf30b76728d39c64af425/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696d6c69616d2f796969322d7472616974732e737667)](https://packagist.org/packages/imliam/yii2-traits)[![License](https://camo.githubusercontent.com/0c76d0bb5fa51a6dc3880a9786f46b913093726ad74c3c7b0e56d8fdf1c67b8d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696d6c69616d2f796969322d7472616974732e737667)](LICENSE.md)

A collection of miscellaneous traits to extend parts of Yii2.

- [Yii2 Traits](#yii2-traits)
    - [💾 Installation](#%F0%9F%92%BE-installation)
    - [📝 Usage](#%F0%9F%93%9D-usage)
        - [`yii\db\Migration`](#yii%5Cdb%5Cmigration)
            - [Migration@fillColumn(string $table, string $column, $value)](#migrationfillcolumnstring-table-string-column-value)
        - [`yii\db\ActiveRecord`](#yii%5Cdb%5Cactiverecord)
            - [ActiveRecord@firstOrCreate(array $attributes, array $values = \[\]): self](#activerecordfirstorcreatearray-attributes-array-values---self)
            - [ActiveRecord@create(array $attributes): self](#activerecordcreatearray-attributes-self)
            - [ActiveRecord@make(array $attributes): self](#activerecordmakearray-attributes-self)
            - [ActiveRecord@deleteIfExists(array $attributes)](#activerecorddeleteifexistsarray-attributes)
            - [ActiveRecord@first(string $orderBy = null)](#activerecordfirststring-orderby--null)
    - [✅ Testing](#%E2%9C%85-testing)
    - [🔖 Changelog](#%F0%9F%94%96-changelog)
    - [⬆️ Upgrading](#%E2%AC%86%EF%B8%8F-upgrading)
    - [🎉 Contributing](#%F0%9F%8E%89-contributing)
        - [🔒 Security](#%F0%9F%94%92-security)
    - [👷 Credits](#%F0%9F%91%B7-credits)
    - [♻️ License](#%E2%99%BB%EF%B8%8F-license)

💾 Installation
--------------

[](#-installation)

You can install the package with [Composer](https://getcomposer.org/) using the following command:

```
composer require imliam/yii2-traits:^1.0.0
```

Once installed, you can then `use` the traits in your existing classes.

📝 Usage
-------

[](#-usage)

### `yii\db\Migration`

[](#yiidbmigration)

#### Migration@fillColumn(string $table, string $column, $value)

[](#migrationfillcolumnstring-table-string-column-value)

Set the default value of an existing column.

```
