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.

Helps protect against SQL injections.


Travis CI Github CI Coverage Status

Install

Requirements

See composer.json.

Installation with Composer

Quick example

Table of Contents

Usage

Connectors

Creating a Connector instance.

Or

Then create a Database instance with the created connector:

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

Using Queries

Both approaches below are valid:

Select Query

Basic Usage

Joins

You can also use innerJoin and leftJoin.

Expressions

Group By

Condition Expressions

Range/Limit

Order By

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

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

Insert Query

Multiple inserts

Or,

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

See the build result * Query * Parameters

Insert expressions

Expressions can be used inside the array passed to the fields() method.

execute() will insert one row into the geom table.

See the build result * Query * Parameters

InsertExpression is also allowed with a MergeQuery.

Update Query

Merge Query

Delete Query

Performs a DELETE query on the given table. All methods from DeleteQuery object.

Create Query

Performs a CREATE TABLE query on the current database.

Field types:

Select-Insert Query

Performs a SELECT, then an INSERT if not found.

By default, the array given in matching() is 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.

The following is equivalent:

Having

Transactions

Full Example

See FullTest.php

Error handling

There are three main exceptions thrown by the Database class:

All of these exceptions have explicit messages (essentially from PDO).

Short usage example:

Unit Tests

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

Then run the unit tests:

To include coverage testing, use:

License

This project 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).

Statistics

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 ...