Download the PHP package finesse/micro-db without Composer

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

MicroDB

Latest Stable Version Total Downloads PHP from Packagist Test Status Maintainability Test Coverage

Like to use pure SQL but don't like to suffer from PDO, mysqli or etc.? Try this.

Key features:

You can combine it with a third-party SQL query builder to rock the database. Examples of suitable query builders: Query Scribe, Nilportugues SQL Query Builder, Aura.SqlQuery, Latitude, Koine Query Builder, Phossa2 Query, Hydrahon.

Installation

Using Composer

Run in a console

Reference

Create a Connection instance

To create a new Connection instance call the create method passing PDO constructor arguments.

Or pass a PDO instance to the constructor. But be careful: Connection changes the given PDO object and you must not change the given object, otherwise something unexpected will happen.

Select

Select many rows:

Select one row:

The cell values are returned as they are returned by PDO. They are not casted automatically because casting can cause data loss.

Insert

Insert and get the number of the inserted rows:

Insert and get the identifier of the last inserted row:

Update

Update rows and get the number of the updated rows:

Delete

Delete rows and get the number of the deleted rows:

Other queries

Perform any other statement:

If the query contains multiple statements separated by a semicolon, only the first statement will be executed. You can execute multiple statements using the other method:

The lack of this method is that it doesn't take values to bind.

Execute a file

Execute the query from an SQL file:

Or from a resource:

Binding values

You should not insert values right to an SQL query because it can cause SQL injections. Instead use the binding:

Database server replaces the placeholders (?s) safely with the given values. Almost all the above methods accepts the list of the bound values as the second argument.

You can also use named parameters:

You can even pass named and anonymous parameters in the same array but it works only when the array of values has the same order as the placeholders in the query text.

All the scalar types of values are supported: string, integer, float, boolean and null.

Error handling

The Finesse\MicroDB\Exceptions\PDOException is thrown in case of every database query error. If an error is caused by an SQL query, the exception has the query text and bound values in the message. They are also available through the methods:

The Finesse\MicroDB\Exceptions\InvalidArgumentException is thrown when the method arguments have a wrong format.

The Finesse\MicroDB\Exceptions\FileException is thrown on a file read error.

All the exceptions implement Finesse\MicroDB\IException.

Retrieve the underlying PDO object

You must not change the retrieved object, otherwise something unexpected will happen.

Known problems

Make a pull request or an issue if you need a problem to be fixed.

Versions compatibility

The project follows the Semantic Versioning.

License

MIT. See the LICENSE file for details.


All versions of micro-db with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
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 finesse/micro-db contains the following files

Loading the files please wait ....