Download the PHP package tivins/database without Composer

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

A PDO Wrapper

A Secure, fluent, lightweight, and efficient PDO wrapper.

Help to protect again SQL injections.


Travis CI Github CI Coverage Status

Install

Requirements

See composer.json.

Install with composer

Quick example

Summary

Usage

Connectors

Creating a Connector instance.

or

Then create an instance of Database, with the created connector :

A ConnectionException can be thrown when the new Database() attempt to connect the given Connector.

Using queries

Both usages below are valid :

Select query

Basic

Join

use as well innerJoin, leftJoin.

Expression

Group by

Condition Expression

Range/Limit

Order by

orderBy() add a new order statement in the query. It can be called multiple times.

Multiple times. In the following example, the results will be sorted by post_type, and then, by date:

Insert query

Multiples inserts

or,

execute() will insert two rows in the table book.

See the build result * Query * Parameters

Insert expressions

Expressions can be used inside the array given to fields() function.

Execute() will insert two rows in the table book.

See the build result * Query * Parameters

InsertExpression are also allowed with a MergeQuery.

Update query

Merge query

Delete query

Perform a delete query on the given table. All methods of DeleteQuery object.

Create query

Perform a create table query on the current database.

Field types :

Select-Insert Query

Perform a select, then an insert if not found.

By default, array given in matching() are used to insert the new record.

You can define the fields for the insert query:

Expressions

You can use SelectQuery::addExpression() to add an expression to the selected fields.

Signature : ->addExpression(string $expression, string $alias, array $args).

Predefined expressions

Count (addCount())

Conditions

Some examples :

Nested conditions

Conditions are available for DeleteQuery.

And below is equivalent :

Having

Transactions

Full Example

See /tests/FullTest.php

Error handling

There are three main exception thrown by Database.

All of these exceptions has an explicit message (from PDO, essentially).

Usage short example :

Unit tests

Create a test database, and a grant to a user on it. Add a phpunit.xml at the root of the repository.

Then, run unit tests :

To include a coverage test, use :

License

Database is released under the MIT License. See the bundled LICENSE file for details.

In addition, if you are using the --dev mode, some parts of the project have their own licenses attached (either in the source files or in a LICENSE file next to them).

Stats

Download Status


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 tivins/database contains the following files

Loading the files please wait ....