Download the PHP package dottwatson/php-mysql-engine without Composer

On this page you can find all versions of the php package dottwatson/php-mysql-engine. 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 php-mysql-engine

PHP MySQL Engine

PHP MySQL Engine is a library for PHP that allows you to test database-driven applications with an in-memory simulation of MySQL 5.6. This project extends the PDO class and allows you to call common PDO MySQL methods. It supports a wide variety of queries, and some PDO-specific functionality like transactions and different fetch modes.

PHP MySQL Engine is based on Slack's Hack SQL Fake created by Scott Sandler.

You can read an article about this tool here.

Motivation

Currently there are two ways to test code that reads and writes to a database:

PHP MySQL Engine takes a different approach - it parses and executes SELECT, INSERT, UPDATE, and DELETE queries against an in-memory "database" stored in PHP arrays. As long as the amount of data used for testing is small, this solves the problems mentioned above.

SQL Syntax Supported

This library supports a wide variety of query syntax, including:

Unsupported MySQL features

This engine does not support MySQL Stored objects, which precludes the testing of stored procedures, triggers and views.

Caveat Emptor

Unlike Psalm, this package is not designed with a wide audience in mind. For a project to really benefit from this library it should already have a large number of tests that require a database connection to complete, and the project maintainers must understand the tradeoffs associated with using an unofficial MySQL implementation in their test suite.

Known issues

Result types when not emulating prepares

By default the engine returns all data formatted as a string. If $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false) is called, the engine will instead infer column types (for example, SUM(some_int_column) will be given an int type). In some cases php-mysql-engine may do a better job of inferring correct column types than actual MySQL, which defaults to string when it can’t work out a column type. If you do strict type checks on the results you may see small discrepancies.

Installation

Usage

PHP MySQL Engine works by providing a subclass of PDO.

You can instantiate the subclass as you would PDO, and use dependency injection or similar to provide that instance to your application code.

The rest of your code can operate as normal, using the database in the same way it is used in production.

Why doesn't it support X?

This library aims to support everything its users use in MySQL, rather than every possibly feature MySQL offers. We welcome pull requests to add support for new syntax, sql functions, data types, bug fixes, and other features.

Why doesn’t this project have an issue tracker?

Maintaining open-source projects is hard work, and I don't want to make more work for me or my colleagues. Use this project very much use at your own risk.

If you want to fork the project with an issue tracker, feel free!

Contributing

If you want to create a PR, please make sure it passes unit tests:

and also Psalm's checks

Thanks!


All versions of php-mysql-engine with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8
ext-pdo Version *
nyholm/dsn Version ^2.0
symfony/polyfill-php73 Version ^1.22
dottwatson/simple-data Version ^1.0
justinrainbow/json-schema Version *
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 dottwatson/php-mysql-engine contains the following files

Loading the files please wait ....