2017 © Pedro Peláez
 

library sql-builder

image

inglar/sql-builder

  • Friday, January 27, 2017
  • by inglar
  • Repository
  • 1 Watchers
  • 0 Stars
  • 244 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 5 % Grown

The README.md

Installation

Composer

Open a command console, enter your project directory and execute the following command to download the latest stable version of this package:, (*1)

$ composer require inglar/sql-builder

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*2)

Supported Adapters

SqlBuilder supports the following database adapters:, (*3)

  • MySQL (specify mysql)
  • PostgreSQL (specify pgsql)

Usage

Simple select, (*4)

$builder = new SqlBuilder('pgsql');
$select = $builder->select()
    ->column('*')
    ->from('table')
    ->where('id = :id')
    ->bindParam(':id', 123);

echo $select;
print_r($select->getBindParams());

The above example will output:, (*5)

SELECT * FROM "table" WHERE id = :id

Array
(
    [:id] => 123
)

Select with join, (*6)

$builder = new SqlBuilder('pgsql');
$select = $builder->select()
    ->column('*')
    ->from('table')
    ->join($builder->join('table2', "table2.user_id = table.id")
    ->where('id = :id')
    ->bindParam(':id', 123);

echo $select;
print_r($select->getBindParams());

The above example will output:, (*7)

SELECT * FROM "table" JOIN "table2" ON table2.user_id = table.id WHERE id = :id

Array
(
    [:id] => 123
)

The Versions

27/01 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=5.5.3

 

The Development Requires

by Igor Kochergin

27/01 2017

1.0.3

1.0.3.0

  Sources   Download

MIT

The Requires

  • php >=5.5.3

 

The Development Requires

by Igor Kochergin

21/11 2016

1.0.2

1.0.2.0

  Sources   Download

MIT

The Requires

  • php >=5.5.3

 

The Development Requires

by Igor Kochergin

14/11 2016

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

  • php >=5.5.3

 

The Development Requires

by Igor Kochergin

23/09 2016

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

  • php >=5.5.3

 

The Development Requires

by Igor Kochergin