Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mikeshiyan/lite-sql-insert

Lightweight SQL insertion service.
https://github.com/mikeshiyan/lite-sql-insert

composer insert lite oop pdo php sql

Last synced: about 2 months ago
JSON representation

Lightweight SQL insertion service.

Awesome Lists containing this project

README

        

# Lite SQL Insert

[![Build Status](https://travis-ci.org/mikeshiyan/lite-sql-insert.svg?branch=master)](https://travis-ci.org/mikeshiyan/lite-sql-insert)

Very lightweight PHP service class for SQL INSERT queries abstraction.

Best suited for use as a [Composer](https://getcomposer.org) library.

## Requirements

* PHP >= 7.1
* PDO extension

## Installation

To add this library to your Composer project:
```
composer require shiyan/lite-sql-insert
```

## Usage

```
$connection = new \Shiyan\LiteSqlInsert\Connection($pdo);
$insert = $connection->insert('my_table', ['name', 'value']);

foreach ($my_data as $name => $value) {
$insert->values(['name' => $name, 'value' => $value]);
}

$insert->commit();
```