Download the PHP package amcsi/amysql without Composer

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

AMysql

Build Status

A MySQL wrapper guaranteed to work on any PHP 5.2+ or HHVM configuration with the mysqli extension or mysql_* functions available. Also contains many tools to help build queries, manage them, profile them.

Is AMysql for you?

Then AMysql is the library for your project!

What AMysql tries to be

What AMysql is not

Requirements

PHP 5.1.0+ is required, although this has only been tested on 5.2 and higher, and either the MySQLi extension or the mysql_* functions must be available.

Installation

Available on packagist.

See INSTALL file.

Usage

Typically you want to make one instance of AMysql per db connection. AMysql lazy connects by default.

Apigen docs are available for this project: http://amcsi.github.io/amysql/apigen/

Instantiating AMysql

When instantiating AMysql, you can pass in either a mysql link resource or connection details as an array.

or

or

The full connection details array supports:

Inserting mysql expressions

Within prepared statement you can purposefully bind literal strings that will not be escaped or enclosed by quotes. Use it with caution.

To use it, see the example below:

AMysql_Expr also supports a few predefined special expressions not only consisting of literal values, such as for making an IN list or for doing proper escaping for a LIKE expression. For more information, check out the AMysql/Expr.php file.

Example for an IN list:

Example for escaping LIKE. Note the automatic escaping handling with the = sign ( http://stackoverflow.com/a/3683868/1381550 ). Do not worry about actual percent and underscore lines, as they will properly be escaped and will be treated as literal characters. The default LIKE pattern is wrapping your search string between two (%) signs for a "contains" match. This is represented internally with a sprintf() pattern of %%%s%s meaning (literal %), (the string), (literal %). You can change this in the 3rd parameter of AMysql_Expr::__construct

Inserting multiple rows of data

Updating a single row

Updating multiple rows

You can update multiple rows with the same insert() method as for single rows if you pass a multidimensional array. It can be an array or rows, or an array of columns with an array of values.

Deleting rows

Queries throw AMysql_Exceptions by default.

AMysql_Exceptions can be checked for several constraint related rejections in a fairly simple and not too error prone way.

Selecting (without AMysql_Select)

Note that if there is only 1 question mark in the prepared string, you may also pass the $binds as a scalar value and it will be treated as if it were the within an array. If you are expecting a possible null value to be bound, do not use the scalar method though (always use an array in that case).

P.S. this is also true for every method that expects a $binds array.

Preparing select first, executing later (without AMysql_Select)

And now with a new AMysql_Select class to help assemble a SELECT SQL string:

Read the commented AMysql_Select file for more details.

A documentation on binding parameters can be found in the comments for AMysql_Statement::execute(). Be sure to check it out.

Profiling

A simple example without having to make your own HTML template:

Alternatively, check out AMysql_Profiler for more options.

Other methods

Many other useful methods are available as well. Check out the source files and read the documentation for the methods.

Apigen docs are available for this project: http://amcsi.github.io/amysql/apigen/

License

MIT

Contribution

If anything doesn't work the way you expect it to, please report in as an issue on github.

If you can provide pull requests to fixes, that would be even better. Work from the master or develop branch, whichever is the latest.


All versions of amysql with dependencies

PHP Build Version
Package Version
Requires php Version >=5.1.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 amcsi/amysql contains the following files

Loading the files please wait ....