Download the PHP package mspirkov/yii2-db without Composer

On this page you can find all versions of the php package mspirkov/yii2-db. 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-db

Yii2 DB Extension

A package of helper classes for working with databases in Yii2.

PHP Yii 2.0.x Total Downloads Tests Coverage PHPStan Level Max

Support

If you like this project, give it a ⭐ on GitHub — it helps others discover it.

Installation

Run

or add

to the require section of your composer.json file.

Components

AbstractRepository

An abstract class for creating repositories that interact with ActiveRecord models.

Contains the most commonly used methods:

It also has several additional methods:

This way, you can separate the logic of executing queries from the ActiveRecord models themselves. This will make your ActiveRecord models thinner and simpler. It will also make testing easier, as you can mock the methods for working with the database.

Usage example

Create an interface based on RepositoryInterface:

Next, create your repository:

After that, specify the implementation of the ProductRepositoryInterface interface in the container in the definitions section:

After that, you can use the repository as follows:

DateTimeBehavior

Behavior for ActiveRecord models that automatically fills the specified attributes with the current date and time.

Usage example

By default, this behavior will fill the created_at attribute with the date and time when the associated AR object is being inserted; it will fill the updated_at attribute with the date and time when the AR object is being updated. The date and time are determined relative to $timeZone.

If your attribute names are different or you want to use a different way of calculating the timestamp, you may configure the $createdAtAttribute, $updatedAtAttribute and $value properties like the following:

TransactionManager

A utility class for managing database transactions with a consistent and safe approach.

This class simplifies the process of wrapping database operations within transactions, ensuring that changes are either fully committed or completely rolled back in case of errors.

It provides two main methods:

Usage example

Initialization

Add the definition to the container configuration in the definitions section:

Usage

All versions of yii2-db with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
yiisoft/yii2 Version ^2.0.53
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 mspirkov/yii2-db contains the following files

Loading the files please wait ...