Download the PHP package hexblot/mssql-compat without Composer

On this page you can find all versions of the php package hexblot/mssql-compat. 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 mssql-compat

MSSQL-Compat

MSSQL Compat is a small and simple drop-in library that allows a legacy PHP project that uses MSSQL via the mssql_* functions ( eg mssql_connect() et al ), removed in PHP 7.0, to work transparently on PHP 5.3 through 8.x with PDO DBLib by providing the missing functions as wrappers around the equivalent PDO syntax - and all that with a single line!

The story

I recently started migrating internal web applications to new servers that use PHP7.

Thus I stumbled on a couple of old applications that use MSSQL with PHP, which I dearly hoped to avoid rewriting and debugging now that PHP 7 has removed the mssql_* family of functions.

The result is this single-file solution: just include it before your first mssql_* call, and it will transparently wrap them to the equivalent PDO calls.

What it is not

Requirements

Hint: On RHEL-like systems the Remi repository provides php-pdo-dblib; on the official Docker images run apt-get install freetds-dev && docker-php-ext-install pdo_dblib.

How to use

Option A: Manually

Just download and add an include to this library on the top of the old application index.php file.

Option B: Via Composer

If your app doesn't already have one, add a require towards the autoload.php file generated by composer in your index.php:

Optional tuning

Extra DSN parameters (charset, TDS version, application name...) can be passed by defining a constant before the library is loaded:

If your application already has an open PDO connection (for instance from a framework), legacy code can share it instead of opening a second one:

Note that the library switches the supplied connection to PDO::ERRMODE_EXCEPTION.

Behaviour notes: how this differs from the original extension

Under the hood: Which functions are covered

The stored procedure API (mssql_init / mssql_bind / mssql_execute) is not covered; call procedures with mssql_query("EXEC ...") instead. Patches are of course very welcomed!

Upgrading from 0.2.x

Version 0.3.1 changes behaviour in ways your application may notice:

License

MIT, since version 0.3.1. Versions up to 0.2.2 were released under the Apache License 2.0.

Running the smoke test

The test uses an in-memory SQLite database, so it needs no SQL Server:


All versions of mssql-compat with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
ext-pdo 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 hexblot/mssql-compat contains the following files

Loading the files please wait ...