Yii PHP Framework Version 2

This is the core framework code of Yii 2.

This repository is a read-only git subsplit of https://github.com/yiisoft/yii2. Please submit issue reports and pull requests to the main repository. For license information check the LICENSE-file.

Installation

The preferred way to install the Yii framework is through composer.

Refer to Bower and NPM Assets installation to select an asset installation method.

Either run

composer require yiisoft/yii2

or add

"yiisoft/yii2": "~2.0.0",

to the require section of your composer.json.

Class Reference

Class Description
yii\base\Action Action is the base class for all controller action classes.
yii\base\ActionEvent ActionEvent represents the event parameter used for an action event.
yii\base\ActionFilter ActionFilter is the base class for action filters.
yii\base\Application Application is the base class for all application classes.
yii\base\ArrayAccessTrait ArrayAccessTrait provides the implementation for IteratorAggregate, ArrayAccess and Countable.
yii\base\Arrayable Arrayable is the interface that should be implemented by classes who want to support customizable representation of their instances.
yii\base\ArrayableTrait ArrayableTrait provides a common implementation of the yii\base\Arrayable interface.
yii\base\BaseObject BaseObject is the base class that implements the property feature.
yii\base\Behavior Behavior is the base class for all behavior classes.
yii\base\BootstrapInterface BootstrapInterface is the interface that should be implemented by classes who want to participate in the application bootstrap process.
yii\base\Component Component is the base class that implements the property, event and behavior features.
yii\base\Configurable Configurable is the interface that should be implemented by classes who support configuring its properties through the last parameter to its constructor.
yii\base\Controller Controller is the base class for classes containing controller logic.
yii\base\DynamicContentAwareInterface DynamicContentAwareInterface is the interface that should be implemented by classes which support a yii\base\View dynamic content feature.
yii\base\DynamicContentAwareTrait DynamicContentAwareTrait implements common methods for classes which support a yii\base\View dynamic content feature.
yii\base\DynamicModel DynamicModel is a model class primarily used to support ad hoc data validation.
yii\base\ErrorException ErrorException represents a PHP error.
yii\base\ErrorHandler ErrorHandler handles uncaught PHP errors and exceptions.
yii\base\Event Event is the base class for all event classes.
yii\base\Exception Exception represents a generic exception for all purposes.
yii\base\ExitException ExitException represents a normal termination of an application.
yii\base\InlineAction InlineAction represents an action that is defined as a controller method.
yii\base\InvalidArgumentException InvalidArgumentException represents an exception caused by invalid arguments passed to a method.
yii\base\InvalidCallException InvalidCallException represents an exception caused by calling a method in a wrong way.
yii\base\InvalidConfigException InvalidConfigException represents an exception caused by incorrect object configuration.
yii\base\InvalidParamException InvalidParamException represents an exception caused by invalid parameters passed to a method.
yii\base\InvalidRouteException InvalidRouteException represents an exception caused by an invalid route.
yii\base\InvalidValueException InvalidValueException represents an exception caused by a function returning a value of unexpected type.
yii\base\Model Model is the base class for data models.
yii\base\ModelEvent ModelEvent represents the parameter needed by yii\base\Model events.
yii\base\Module Module is the base class for module and application classes.
yii\base\NotSupportedException NotSupportedException represents an exception caused by accessing features that are not supported.
yii\base\Request Request represents a request that is handled by an yii\base\Application.
yii\base\Response Response represents the response of an yii\base\Application to a yii\base\Request.
yii\base\Security Security provides a set of methods to handle common security-related tasks.
yii\base\StaticInstanceInterface StaticInstanceInterface is the interface for providing static instances to classes, which can be used to obtain class meta information that can not be expressed in static methods.
yii\base\StaticInstanceTrait StaticInstanceTrait provides methods to satisfy yii\base\StaticInstanceInterface interface.
yii\base\Theme Theme represents an application theme.
yii\base\UnknownClassException UnknownClassException represents an exception caused by using an unknown class.
yii\base\UnknownMethodException UnknownMethodException represents an exception caused by accessing an unknown object method.
yii\base\UnknownPropertyException UnknownPropertyException represents an exception caused by accessing unknown object properties.
yii\base\UserException UserException is the base class for exceptions that are meant to be shown to end users.
yii\base\View View represents a view object in the MVC pattern.
yii\base\ViewContextInterface ViewContextInterface is the interface that should implemented by classes who want to support relative view names.
yii\base\ViewEvent ViewEvent represents events triggered by the yii\base\View component.
yii\base\ViewNotFoundException ViewNotFoundException represents an exception caused by view file not found.
yii\base\ViewRenderer ViewRenderer is the base class for view renderer classes.
yii\base\Widget Widget is the base class for widgets.
yii\base\WidgetEvent WidgetEvent represents the event parameter used for a widget event.
yii\console\Application Application represents a console application.
yii\console\Controller Controller is the base class of console command classes.
yii\console\ErrorHandler ErrorHandler handles uncaught PHP errors and exceptions.
yii\console\Exception Exception represents an exception caused by incorrect usage of a console command.
yii\console\ExitCode This class provides constants for defining console command exit codes.
yii\console\Markdown A Markdown parser that enhances markdown for reading in console environments.
yii\console\Request The console Request represents the environment information for a console application.
yii\console\Response The console Response represents the result of a console application.
yii\console\UnknownCommandException UnknownCommandException represents an exception caused by incorrect usage of a console command.
yii\console\controllers\AssetController Allows you to combine and compress your JavaScript and CSS files.
yii\console\controllers\BaseMigrateController BaseMigrateController is the base class for migrate controllers.
yii\console\controllers\CacheController Allows you to flush cache.
yii\console\controllers\FixtureController Manages fixture data loading and unloading.
yii\console\controllers\HelpController Provides help information about console commands.
yii\console\controllers\MessageController Extracts messages to be translated from source files.
yii\console\controllers\MigrateController Manages application migrations.
yii\console\controllers\ServeController Runs PHP built-in web server.
yii\console\widgets\Table Table class displays a table in console.
yii\data\ActiveDataFilter ActiveDataFilter allows composing a filtering condition in a format suitable for yii\db\QueryInterface::where().
yii\data\ActiveDataProvider ActiveDataProvider implements a data provider based on yii\db\Query and yii\db\ActiveQuery.
yii\data\ArrayDataProvider ArrayDataProvider implements a data provider based on a data array.
yii\data\BaseDataProvider BaseDataProvider provides a base class that implements the yii\data\DataProviderInterface.
yii\data\DataFilter DataFilter is a special yii\base\Model for processing query filtering specification.
yii\data\DataProviderInterface DataProviderInterface is the interface that must be implemented by data provider classes.
yii\data\Pagination Pagination represents information relevant to pagination of data items.
yii\data\Sort Sort represents information relevant to sorting.
yii\data\SqlDataProvider SqlDataProvider implements a data provider based on a plain SQL statement.
yii\db\ActiveQuery ActiveQuery represents a DB query associated with an Active Record class.
yii\db\ActiveQueryInterface ActiveQueryInterface defines the common interface to be implemented by active record query classes.
yii\db\ActiveQueryTrait ActiveQueryTrait implements the common methods and properties for active record query classes.
yii\db\ActiveRecord ActiveRecord is the base class for classes representing relational data in terms of objects.
yii\db\ActiveRecordInterface ActiveRecordInterface.
yii\db\ActiveRelationTrait ActiveRelationTrait implements the common methods and properties for active record relational queries.
yii\db\AfterSaveEvent AfterSaveEvent represents the information available in yii\db\ActiveRecord::EVENT_AFTER_INSERT and yii\db\ActiveRecord::EVENT_AFTER_UPDATE.
yii\db\ArrayExpression Class ArrayExpression represents an array SQL expression.
yii\db\BaseActiveRecord ActiveRecord is the base class for classes representing relational data in terms of objects.
yii\db\BatchQueryResult BatchQueryResult represents a batch query from which you can retrieve data in batches.
yii\db\CheckConstraint CheckConstraint represents the metadata of a table CHECK constraint.
yii\db\ColumnSchema ColumnSchema class describes the metadata of a column in a database table.
yii\db\ColumnSchemaBuilder ColumnSchemaBuilder helps to define database schema types using a PHP interface.
yii\db\Command Command represents a SQL statement to be executed against a database.
yii\db\Connection Connection represents a connection to a database via PDO.
yii\db\Constraint Constraint represents the metadata of a table constraint.
yii\db\ConstraintFinderInterface ConstraintFinderInterface defines methods for getting a table constraint information.
yii\db\ConstraintFinderTrait ConstraintFinderTrait provides methods for getting a table constraint information.
yii\db\DataReader DataReader represents a forward-only stream of rows from a query result set.
yii\db\DefaultValueConstraint DefaultValueConstraint represents the metadata of a table DEFAULT constraint.
yii\db\Exception Exception represents an exception that is caused by some DB-related operations.
yii\db\Expression Expression represents a DB expression that does not need escaping or quoting.
yii\db\ExpressionBuilder Class ExpressionBuilder builds objects of \yii\db\yii\db\Expression class.
yii\db\ExpressionBuilderInterface Interface ExpressionBuilderInterface is designed to build raw SQL from specific expression objects that implement yii\db\ExpressionInterface.
yii\db\ExpressionBuilderTrait Trait ExpressionBuilderTrait provides common constructor for classes that should implement yii\db\ExpressionBuilderInterface
yii\db\ExpressionInterface Interface ExpressionInterface should be used to mark classes, that should be built in a special way.
yii\db\ForeignKeyConstraint ForeignKeyConstraint represents the metadata of a table FOREIGN KEY constraint.
yii\db\IndexConstraint IndexConstraint represents the metadata of a table INDEX constraint.
yii\db\IntegrityException Exception represents an exception that is caused by violation of DB constraints.
yii\db\JsonExpression Class JsonExpression represents data that should be encoded to JSON.
yii\db\Migration Migration is the base class for representing a database migration.
yii\db\MigrationInterface The MigrationInterface defines the minimum set of methods to be implemented by a database migration.
yii\db\PdoValue Class PdoValue represents a $value that should be bound to PDO with exact $type.
yii\db\PdoValueBuilder Class PdoValueBuilder builds object of the yii\db\PdoValue expression class.
yii\db\Query Query represents a SELECT SQL statement in a way that is independent of DBMS.
yii\db\QueryBuilder QueryBuilder builds a SELECT SQL statement based on the specification given as a yii\db\Query object.
yii\db\QueryExpressionBuilder Class QueryExpressionBuilder is used internally to build yii\db\Query object using unified yii\db\QueryBuilder expression building interface.
yii\db\QueryInterface The QueryInterface defines the minimum set of methods to be implemented by a database query.
yii\db\QueryTrait The BaseQuery trait represents the minimum method set of a database Query.
yii\db\Schema Schema is the base class for concrete DBMS-specific schema classes.
yii\db\SchemaBuilderTrait SchemaBuilderTrait contains shortcut methods to create instances of yii\db\ColumnSchemaBuilder.
yii\db\SqlToken SqlToken represents SQL tokens produced by yii\db\SqlTokenizer or its child classes.
yii\db\SqlTokenizer SqlTokenizer splits an SQL query into individual SQL tokens.
yii\db\StaleObjectException
yii\db\TableSchema TableSchema represents the metadata of a database table.
yii\db\Transaction Transaction represents a DB transaction.
yii\db\ViewFinderTrait ViewFinderTrait implements the method getViewNames for finding views in a database.
yii\db\conditions\AndCondition Condition that connects two or more SQL expressions with the AND operator.
yii\db\conditions\BetweenColumnsCondition Class BetweenColumnCondition represents a BETWEEN condition where values is between two columns. For example:
yii\db\conditions\BetweenColumnsConditionBuilder Class BetweenColumnsConditionBuilder builds objects of yii\db\conditions\BetweenColumnsCondition
yii\db\conditions\BetweenCondition Class BetweenCondition represents a BETWEEN condition.
yii\db\conditions\BetweenConditionBuilder Class BetweenConditionBuilder builds objects of yii\db\conditions\BetweenCondition
yii\db\conditions\ConditionInterface Interface ConditionInterface should be implemented by classes that represent a condition in DBAL of framework.
yii\db\conditions\ConjunctionCondition Class ConjunctionCondition
yii\db\conditions\ConjunctionConditionBuilder Class ConjunctionConditionBuilder builds objects of abstract class yii\db\conditions\ConjunctionCondition
yii\db\conditions\ExistsCondition Condition that represents EXISTS operator.
yii\db\conditions\ExistsConditionBuilder Class ExistsConditionBuilder builds objects of yii\db\conditions\ExistsCondition
yii\db\conditions\HashCondition Condition based on column-value pairs.
yii\db\conditions\HashConditionBuilder Class HashConditionBuilder builds objects of yii\db\conditions\HashCondition
yii\db\conditions\InCondition Class InCondition represents IN condition.
yii\db\conditions\InConditionBuilder Class InConditionBuilder builds objects of yii\db\conditions\InCondition
yii\db\conditions\LikeCondition Class LikeCondition represents a LIKE condition.
yii\db\conditions\LikeConditionBuilder Class LikeConditionBuilder builds objects of yii\db\conditions\LikeCondition
yii\db\conditions\NotCondition Condition that inverts passed \yii\db\conditions\condition.
yii\db\conditions\NotConditionBuilder Class NotConditionBuilder builds objects of yii\db\conditions\NotCondition
yii\db\conditions\OrCondition Condition that connects two or more SQL expressions with the AND operator.
yii\db\conditions\SimpleCondition Class SimpleCondition represents a simple condition like "column" operator value.
yii\db\conditions\SimpleConditionBuilder Class NotConditionBuilder builds objects of yii\db\conditions\SimpleCondition
yii\db\cubrid\ColumnSchemaBuilder ColumnSchemaBuilder is the schema builder for Cubrid databases.
yii\db\cubrid\QueryBuilder QueryBuilder is the query builder for CUBRID databases (version 9.3.x and higher).
yii\db\cubrid\Schema Schema is the class for retrieving metadata from a CUBRID database (version 9.3.x and higher).
yii\db\cubrid\conditions\LikeConditionBuilder
yii\db\mssql\ColumnSchema Class ColumnSchema for MSSQL database
yii\db\mssql\PDO This is an extension of the default PDO class of MSSQL and DBLIB drivers.
yii\db\mssql\QueryBuilder QueryBuilder is the query builder for MS SQL Server databases (version 2008 and above).
yii\db\mssql\Schema Schema is the class for retrieving metadata from MS SQL Server databases (version 2008 and above).
yii\db\mssql\SqlsrvPDO This is an extension of the default PDO class of SQLSRV driver.
yii\db\mssql\TableSchema TableSchema represents the metadata of a database table.
yii\db\mssql\conditions\InConditionBuilder
yii\db\mssql\conditions\LikeConditionBuilder
yii\db\mysql\ColumnSchema Class ColumnSchema for MySQL database
yii\db\mysql\ColumnSchemaBuilder ColumnSchemaBuilder is the schema builder for MySQL databases.
yii\db\mysql\JsonExpressionBuilder Class JsonExpressionBuilder builds yii\db\JsonExpression for MySQL DBMS.
yii\db\mysql\QueryBuilder QueryBuilder is the query builder for MySQL databases.
yii\db\mysql\Schema Schema is the class for retrieving metadata from a MySQL database (version 4.1.x and 5.x).
yii\db\oci\ColumnSchemaBuilder ColumnSchemaBuilder is the schema builder for Oracle databases.
yii\db\oci\QueryBuilder QueryBuilder is the query builder for Oracle databases.
yii\db\oci\Schema Schema is the class for retrieving metadata from an Oracle database.
yii\db\oci\conditions\InConditionBuilder
yii\db\oci\conditions\LikeConditionBuilder
yii\db\pgsql\ArrayExpressionBuilder Class ArrayExpressionBuilder builds yii\db\ArrayExpression for PostgreSQL DBMS.
yii\db\pgsql\ArrayParser The class converts PostgreSQL array representation to PHP array
yii\db\pgsql\ColumnSchema Class ColumnSchema for PostgreSQL database.
yii\db\pgsql\JsonExpressionBuilder Class JsonExpressionBuilder builds yii\db\JsonExpression for PostgreSQL DBMS.
yii\db\pgsql\QueryBuilder QueryBuilder is the query builder for PostgreSQL databases.
yii\db\pgsql\Schema Schema is the class for retrieving metadata from a PostgreSQL database (version 9.x and above).
yii\db\sqlite\ColumnSchemaBuilder ColumnSchemaBuilder is the schema builder for Sqlite databases.
yii\db\sqlite\Command Command represents an SQLite's SQL statement to be executed against a database.
yii\db\sqlite\QueryBuilder QueryBuilder is the query builder for SQLite databases.
yii\db\sqlite\Schema Schema is the class for retrieving metadata from a SQLite (2/3) database.
yii\db\sqlite\SqlTokenizer SqlTokenizer splits SQLite query into individual SQL tokens.
yii\db\sqlite\conditions\InConditionBuilder
yii\db\sqlite\conditions\LikeConditionBuilder
yii\filters\AccessControl AccessControl provides simple access control based on a set of rules.
yii\filters\AccessRule This class represents an access rule defined by the yii\filters\AccessControl action filter.
yii\filters\AjaxFilter AjaxFilter allow to limit access only for ajax requests.
yii\filters\ContentNegotiator ContentNegotiator supports response format negotiation and application language negotiation.
yii\filters\Cors Cors filter implements Cross Origin Resource Sharing.
yii\filters\HostControl HostControl provides simple control over requested host name.
yii\filters\HttpCache HttpCache implements client-side caching by utilizing the Last-Modified and ETag HTTP headers.
yii\filters\PageCache PageCache implements server-side caching of whole pages.
yii\filters\RateLimitInterface RateLimitInterface is the interface that may be implemented by an identity object to enforce rate limiting.
yii\filters\RateLimiter RateLimiter implements a rate limiting algorithm based on the leaky bucket algorithm.
yii\filters\VerbFilter VerbFilter is an action filter that filters by HTTP request methods.
yii\filters\auth\AuthInterface AuthInterface is the interface that should be implemented by auth method classes.
yii\filters\auth\AuthMethod AuthMethod is a base class implementing the yii\filters\auth\AuthInterface interface.
yii\filters\auth\CompositeAuth CompositeAuth is an action filter that supports multiple authentication methods at the same time.
yii\filters\auth\HttpBasicAuth HttpBasicAuth is an action filter that supports the HTTP Basic authentication method.
yii\filters\auth\HttpBearerAuth HttpBearerAuth is an action filter that supports the authentication method based on HTTP Bearer token.
yii\filters\auth\HttpHeaderAuth HttpHeaderAuth is an action filter that supports HTTP authentication through HTTP Headers.
yii\filters\auth\QueryParamAuth QueryParamAuth is an action filter that supports the authentication based on the access token passed through a query parameter.
yii\helpers\ArrayHelper ArrayHelper provides additional array functionality that you can use in your application.
yii\helpers\BaseArrayHelper BaseArrayHelper provides concrete implementation for yii\helpers\ArrayHelper.
yii\helpers\BaseConsole BaseConsole provides concrete implementation for yii\helpers\Console.
yii\helpers\BaseFileHelper BaseFileHelper provides concrete implementation for yii\helpers\FileHelper.
yii\helpers\BaseFormatConverter BaseFormatConverter provides concrete implementation for yii\helpers\FormatConverter.
yii\helpers\BaseHtml BaseHtml provides concrete implementation for yii\helpers\Html.
yii\helpers\BaseHtmlPurifier BaseHtmlPurifier provides concrete implementation for yii\helpers\HtmlPurifier.
yii\helpers\BaseInflector BaseInflector provides concrete implementation for yii\helpers\Inflector.
yii\helpers\BaseIpHelper Class BaseIpHelper provides concrete implementation for yii\helpers\IpHelper
yii\helpers\BaseJson BaseJson provides concrete implementation for yii\helpers\Json.
yii\helpers\BaseMarkdown BaseMarkdown provides concrete implementation for yii\helpers\Markdown.
yii\helpers\BaseStringHelper BaseStringHelper provides concrete implementation for yii\helpers\StringHelper.
yii\helpers\BaseUrl BaseUrl provides concrete implementation for yii\helpers\Url.
yii\helpers\BaseVarDumper BaseVarDumper provides concrete implementation for yii\helpers\VarDumper.
yii\helpers\Console Console helper provides useful methods for command line related tasks such as getting input or formatting and coloring output.
yii\helpers\FileHelper File system helper.
yii\helpers\FormatConverter FormatConverter provides functionality to convert between different formatting pattern formats.
yii\helpers\Html Html provides a set of static methods for generating commonly used HTML tags.
yii\helpers\HtmlPurifier HtmlPurifier provides an ability to clean up HTML from any harmful code.
yii\helpers\Inflector Inflector pluralizes and singularizes English nouns. It also contains some other useful methods.
yii\helpers\IpHelper Class IpHelper provides a set of IP-related static methods.
yii\helpers\Json Json is a helper class providing JSON data encoding and decoding.
yii\helpers\Markdown Markdown provides an ability to transform markdown into HTML.
yii\helpers\ReplaceArrayValue Object that represents the replacement of array value while performing yii\helpers\ArrayHelper::merge().
yii\helpers\StringHelper StringHelper.
yii\helpers\UnsetArrayValue Object that represents the removal of array value while performing yii\helpers\ArrayHelper::merge().
yii\helpers\Url Url provides a set of static methods for managing URLs.
yii\helpers\VarDumper VarDumper is intended to replace the buggy PHP function var_dump and print_r.
yii\web\Controller Controller is the base class of web controllers.