Download the PHP package sam-it/yii2-mariadb without Composer

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

Latest Stable Version Total Downloads Scrutinizer Code Quality Code Coverage Continous integration

yii2-mariadb

While Yii2 supports MariaDB through its MySQL driver, the differences between MariaDB and MySQL are increasing. At this time the driver included in Yii2 will not properly detect JSON columns in MariaDB and will not properly store data in them.

The goal of this library is to implement the MariaDB specific changes required to get all features working in MariaDB that are supported in the Yii2 core library for other DBMSes.

Tests

The tests coverage is really high due to 2 reasons:

Usage

To use the MariaDB Schema implementation there are several approaches.

Override the schema class used for MySQL

Update the schemaMap property in your Connection config (the drivername is still mysql since we use the MySQL PDO driver) (RECOMMENDED)

Add schema class to schemaMap

Append the new Schema class to the schemaMap property and set the driverName property manually.

JSON Column detection

Since MariaDB has no built-in JSON data type we need to do some extra work to detect JSON columns. We do this by parsing the SQL obtained when using SHOW CREATE TABLE. Since MariaDB supports CHECK constraints these are used to ensure a column can only contain valid JSON. Any constraint that of the form: json_valid(`column1`) will identify the column as JSON. Note that this could lead to problems if you have weird constraints, consider this:

Will mark column1 as a JSON column.

Column creation

When creating JSON columns the ColumnSchemaBuilder requires the name of the column to add the table constraint. Since this is not the case for all other column types Yii does not pass the name of the column to the builder. Consider this code, for example in a migration:

Here there is no way for the ColumnSchemaBuilder to know what the name of the column is going to be. Since the schema builder is ultimately passed to QueryBuilder::alterColumn(), we can intercept it there and replace the column name in the constraint.

If you coerce the ColumnSchemaBuilder to string early, or use it without the QueryBuilder you will end up with SQL like this:

That will clearly not work. For those cases we have added a toString(string $columnName) method to the builder.


All versions of yii2-mariadb with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.4
ext-pdo Version *
ext-pdo_mysql Version *
yiisoft/yii2 Version > 2.0.14
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 sam-it/yii2-mariadb contains the following files

Loading the files please wait ....