Download the PHP package leinonen/yii2-eloquent without Composer

On this page you can find all versions of the php package leinonen/yii2-eloquent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-eloquent

Latest Stable Version Total Downloads Latest Unstable Version License Build Status SensioLabsInsight

Yii2-eloquent

A drop in Laravels Eloquent and Illuminate/Database implementation for Yii2

Features:

Installation

Require this package, with Composer, in the root directory of your project.

Configuration:

To configure the package just override and bootstrap your Yii db component in the application config.

Usage:

Like said, by default the package overrides Yii's database component. So one you can access Illuminate\Database\Capsule\Manager like this:

However its much more preferable to access the capsule with static methods or inject it via dependency injection. IDEs cannot autocomplete accessing the db component from the Yii god object.

For complete docs please refer to: Illuminate\Database and Laravel

Eloquent

Using Eloquent is covered in Laravels documentation. However this package provides also an altenrative base model which to extend form. By extending from leinonen\Yii2Eloquent\Eloquent\Model instead of Illuminate\Database\Eloquent\Model you'll get some Yii functionalities to your Eloquent models. For example you can then declare rules() scenarios() etc. as you are used with Yiis AR models. These can then be also fed to ActiveForm widget, validated using $model->validate() etc.

Simple example of Eloquent Model:

The package also provides a simple trait to make your Eloquent user model compatible with Yii's IdentityInterface. Just use leinonen\Yii2Eloquent\Eloquent\AuthenticatableTrait;

Migrations

If you want to use Yiis basic migration commands you have overwrite the default migration controller in the console app config.

Then all the commands php yii migrate/create etc. will work as expected. Note that you have to use the Capsulein migrations instead of refering to Yiis base migration class:

Fixtures

If you like Yiis fixtures no worries! Just extend leinonen\Yii2Eloquent\Fixtures\EloquentFixture when creating the Fixture class and everything will work as usual:


All versions of yii2-eloquent with dependencies

PHP Build Version
Package Version
Requires illuminate/database Version ^5.1
illuminate/events Version ^5.1
illuminate/pagination Version ^5.1
yiisoft/yii2 Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package leinonen/yii2-eloquent contains the following files

Loading the files please wait ....