Download the PHP package mrjgreen/database without Composer

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

Database

Build Status Coverage Status Latest Stable Version License Total Downloads

The Database component is a framework agnostic PHP database abstraction layer, providing an expressive query builder. It currently supports MySQL, Postgres, SQL Server, and SQLite.

Features:

The component is based on Laravel's Illuminate\Database and has very familiar syntax. The core Query Builder is mostly compatible. The main alterations are to the composition of the objects, and most significantly the creation and resolution of connections within the ConnectionFactory and ConnectionResolver classes.

Installation

Basic Example

First, create a new "ConnectionFactory" instance.

Documentation

Table of Contents

Connection

The Database component supports MySQL, SQLite, SqlServer and PostgreSQL drivers. You can specify the driver during connection and the associated configuration when creating a new connection. You can also create multiple connections, but you can use alias for only one connection at a time.;

MySQL

SQLite

Default Connection Options

By default the following PDO attributes will be set on connection. You can override these or add to them in the options array parameter in the connection config.

Connection Resolver

Many complex applications may need more than one database connection. You can create a set of named connections inside the connection resolver, and reference them by name within in your application.

If you request a connection that you have used previously in your application, the connection resolver will return the same connection, rather than create a new one.

You can set a default connection after creating the resolver, so you don't have to specify the connection name throughout your application.

Raw Queries

Perform a query, with bindings and return the PDOStatement object

Query Shortcuts

Query Builder

Selects

Get PDOStatement

If you intend to iterate through the rows, it may be more efficient to get the PDOStatement

Get All

Get First Row

Find By ID

The query above assumes your table's primary key is 'id' and you want to retreive all columns. You can specify the columns you want to fetch, and your primary key:

Select Columns

Limit and Offset

Where

Grouped Where

Group By, Order By and Having

Joins

Multiple Join Criteria

If you need more than one criterion to join a table then you can pass a closure as second parameter.

Sub Selects

This will produce a query like this:

SELECT (SELECT `name` FROM `customer` WHERE `id` = users.id) as `tmp` FROM `users`

Aggregates

Count
Min
Max
Average
Sum

MySQL Outfile

Insert

Insert Ignore

Ignore errors from any rows inserted with a duplicate unique key

Replace

Replace existing rows with a matching unique key

Batch Insert

The query builder will intelligently handle multiple insert rows:

You can also pass bulk inserts to replace() and insertIgnore()

On Duplicate Key Update

Insert Select

$connection->table('users')->insertSelect(function($select){ $select->from('admin') ->select('name', 'email') ->where('status', '=', 1);

}, array('name','email'));

insertIgnoreSelect and replaceSelect methods are supported for the MySQL grammar driver.

Buffered Iterator Insert

If you have a large data set you can insert in batches of a chosen size (insert ignore/replace/on duplicate key update supported).

This is especially useful if you want to select large data-sets from one server and insert into another.

Update

Delete

Will delete all the rows where id is greater than 5.

Raw Expressions

Wrap raw queries with $connection->raw() to bypass query parameter binding. NB use with caution - no sanitisation will take place.

Get SQL Query and Bindings

Raw PDO Instance


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
psr/log Version ~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 mrjgreen/database contains the following files

Loading the files please wait ....