{"id":15692622,"url":"https://github.com/belgattitude/soluble-dbwrapper","last_synced_at":"2025-05-08T02:43:54.540Z","repository":{"id":56050201,"uuid":"48876769","full_name":"belgattitude/soluble-dbwrapper","owner":"belgattitude","description":"Extra minimalist but universal database wrapper","archived":false,"fork":false,"pushed_at":"2020-11-28T17:45:21.000Z","size":464,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T16:52:43.427Z","etag":null,"topics":["database","database-adapter","doctrine","interop","minimalist","mssql","mysql","oracle","php","postgresql","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/belgattitude.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-01T11:48:33.000Z","updated_at":"2023-09-08T17:05:16.000Z","dependencies_parsed_at":"2022-08-15T12:10:45.613Z","dependency_job_id":null,"html_url":"https://github.com/belgattitude/soluble-dbwrapper","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belgattitude%2Fsoluble-dbwrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belgattitude%2Fsoluble-dbwrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belgattitude%2Fsoluble-dbwrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belgattitude%2Fsoluble-dbwrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/belgattitude","download_url":"https://codeload.github.com/belgattitude/soluble-dbwrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252989678,"owners_count":21836662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","database-adapter","doctrine","interop","minimalist","mssql","mysql","oracle","php","postgresql","sqlite3"],"created_at":"2024-10-03T18:36:39.985Z","updated_at":"2025-05-08T02:43:54.522Z","avatar_url":"https://github.com/belgattitude.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# soluble/dbwrapper\n\n[![PHP 7.1+](https://img.shields.io/badge/php-7.1+-ff69b4.svg)](https://packagist.org/packages/soluble/dbwrapper)\n[![Build Status](https://travis-ci.org/belgattitude/soluble-dbwrapper.png?branch=master)](https://travis-ci.org/belgattitude/soluble-dbwrapper)\n[![codecov](https://codecov.io/gh/belgattitude/soluble-dbwrapper/branch/master/graph/badge.svg)](https://codecov.io/gh/belgattitude/soluble-dbwrapper)\n[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/belgattitude/soluble-dbwrapper/badges/quality-score.png?s=6f3ab91f916bf642f248e82c29857f94cb50bb33)](https://scrutinizer-ci.com/g/belgattitude/soluble-dbwrapper)\n[![Latest Stable Version](https://poser.pugx.org/soluble/dbwrapper/v/stable.svg)](https://packagist.org/packages/soluble/dbwrapper)\n[![Total Downloads](https://poser.pugx.org/soluble/dbwrapper/downloads.png)](https://packagist.org/packages/soluble/dbwrapper)\n[![License](https://poser.pugx.org/soluble/dbwrapper/license.png)](https://packagist.org/packages/soluble/dbwrapper)\n\n## Introduction\n\nMinimalist *(but universal)* database wrapper to rule them all *(and to not choose)*.\n\n## Features\n\n- Provide a generic API for handling database access across various implementations.\n- Lightweight, framework adaptive and agnostic. \n- Natively supports `mysqli`, `pdo_mysql`, `pdo_sqlite` drivers.\n- Bridged implementations of `zend-db`, `laravel` and `doctrine`.\n  - Access to Oracle, SQL-Server, PostgreSql,...\n  - Allow to develop database portable libraries.\n- Adhere to soluble programming standards.\n\n## Requirements\n\n- PHP 7.1 optional ext-mysqli/PDO\n\n\u003e For PHP 5.6+, 7.0+ or HHVM \u003e= 3.9 look at version 1.3.\n\u003e For PHP \u003c 5.6 take the 1.2 version\n\n## Documentation\n\n - [Manual](http://docs.soluble.io/soluble-dbwrapper/manual/) in progress and [API documentation](http://docs.soluble.io/soluble-dbwrapper/api/) available.\n\n## Installation\n\nInstant installation via [composer](http://getcomposer.org/).\n\n```console\n$ composer require soluble/dbwrapper\n```\n\n## Quick start\n\n### Connection\n\nCreate an adapter from an existing Mysqli connection\n\n```php\n\u003c?php\n\nuse Soluble\\DbWrapper;\n\n$conn = new \\mysqli($hostname,$username,$password,$database);\n$conn-\u003eset_charset($charset);\n\n$adapter = DbWrapper\\AdapterFactory::createAdapterFromResource($conn);\n\n```\n\n### Querying database\n\nExecute SQL\n\n```php\n\u003c?php\n$results = $adapter-\u003equery(\"select * from my_table\");\nforeach($results as $result) {\n    echo $result['my_column'];\n}\n```\n\n### Get connection infos\n\nExecute SQL\n\n```php\n\u003c?php\n$connection = $adapter-\u003egetConnection();\necho $connection-\u003egetCurrentSchema();\necho $connection-\u003egetHost();\n\n$resource = $connection-\u003egetResource();\n```\n\n## API methods\n\n### AdapterFactory\n\nThe `DbWrapper\\AdapterFactory` allows to instanciate an Adapter from en existing connection link or resource.\n \n| Methods                                       | Return             | Comment                             |\n|-----------------------------------------------|--------------------|-------------------------------------|\n| static `createAdapterFromResource($resource)` | `AdapterInterface` | From existing resource (mysqli, pdo) |\n| static `createAdapterFromDbal2($dbal)`        | `AdapterInterface` | From doctrine/dbal connection |\n| static `createAdapterFromCapsule5($capsule)`  | `AdapterInterface` | From Laravel connection |\n| static `createAdapterFromZendDb2($zend)`      | `AdapterInterface` | From zend-db connection |\n\n\n### AdapterInterface\n\nThe `DbWrapper\\Adapter\\AdapterInterface` provides common operation on your database.\n\n| Methods                  | Return        | Description                                   |\n|--------------------------|---------------|-----------------------------------------------|\n| `query($query)`          | `Resultset`   | Iterable results `DbWrapper\\Result\\Resultset` |\n| `execute($query)`        | `void`        | Execute command (set, ...)                    |\n| `quoteValue($value)`     | `string`      | Quote value                                   |\n| `getConnection()`        | `ConnectionInterface`  | ConnectionInterface                  |\n\n### Resultset\n\nThe `DbWrapper\\Result\\Resultset` is can be easily iterated through a simple foreach loop. \nAdditionnaly you can call the following methods :\n\n| Methods                         | Return        | Description                                   |\n|---------------------------------|---------------|-----------------------------------------------|\n| `count()`                       | `int`         | Count the number of results                   |\n\n\n### ConnectionInterface\n\nThe `DbWrapper\\Connection\\ConnectionInterface` provides information about your connection\n\n| Methods                  | Return        | Description                                   |\n|--------------------------|---------------|-----------------------------------------------|\n| `getCurrentSchema()`     | `string|false`| Return current schema                         |\n| `getResource()`          | `mixed`       | Return internal connection (pdo, mysqli...)   |\n| `getHost()`              | `string`      | Return server hostname or IP                  |\n\n\n## Supported databases\n\n### Native \n\n`soluble/dbwrapper` supports natively :\n\n| Database   | PHP ext                                              |\n|------------|------------------------------------------------------|\n| Mysql      | mysqli, pdo_mysql                                    |\n| MariaDb    | mysqli, pdo_mysql                                    |\n| Sqlite     | pdo_sqlite                                           |\n\nFor examples, see the [native drivers doc](./docs/drivers/native-drivers.md)\n\n### *Userland* implementations\n\nSome of the supported databases can be (incomplete list) :\n\n| Database   | Doctrine   | Laravel | Zend      |\n|------------|------------|---------|-----------|\n| Mysql      | Yes        | Yes     | Yes       |\n| MariaDb    | Yes        | Yes     | Yes       | \n| Sqlite     | Yes        | Yes     | Yes       |\n| Oracle     | Yes        | No      | Yes       |\n| Sqlserver  | Yes        | Yes     | Yes       |\n| Postgres   | Yes        | Yes     | Yes       |\n(...)\n\n\nFor examples, see the [userland drivers doc](./docs/drivers/userland-drivers.md)\n\n## Motivations\n\nInitially the reason behind the development of `soluble/dbwrapper` was to get\na reliable and lightweight library to abstract the `PDO_mysql` and `mysqli` driver interfaces.\n\nLater on, while developing some libraries, I feel the need for something more framework agnostic that could still\nbe integrated easily into any modern framework. The *userland* drivers idea was born.\n\n## Contributing\n\nContribution and pull request are more than welcome, see the [contribution guide](./CONTRIBUTING.md)\n\n## Coding standards\n\n* [PSR 4 Autoloader](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md)\n* [PSR 2 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelgattitude%2Fsoluble-dbwrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbelgattitude%2Fsoluble-dbwrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelgattitude%2Fsoluble-dbwrapper/lists"}