├── LICENSE ├── README.md ├── composer.json ├── phpdoc.xml └── src ├── DatabaseException.php ├── DatabaseOptions.php ├── DatabaseOptionsTrait.php ├── Dialects ├── Dialect.php ├── DialectAbstract.php ├── Firebird.php ├── MSSQL.php ├── MySQL.php ├── Postgres.php └── SQLite.php ├── Drivers ├── DriverAbstract.php ├── DriverException.php ├── DriverInterface.php ├── MSSqlSrv.php ├── MySQLiDrv.php ├── PDODriverAbstract.php ├── PDOFirebird.php ├── PDOMSSqlSrv.php ├── PDOMySQL.php ├── PDOPostgreSQL.php ├── PDOSQLite.php └── PostgreSQL.php ├── Query ├── Alter.php ├── AlterDatabase.php ├── AlterTable.php ├── BindValues.php ├── CachedQuery.php ├── Create.php ├── CreateDatabase.php ├── CreateTable.php ├── Delete.php ├── Drop.php ├── DropDatabase.php ├── DropTable.php ├── IfExists.php ├── IfNotExists.php ├── Insert.php ├── Limit.php ├── MultiQuery.php ├── Query.php ├── QueryException.php ├── Select.php ├── Show.php ├── ShowCreateTable.php ├── ShowDatabases.php ├── ShowTables.php ├── Statement.php ├── StatementAbstract.php ├── Truncate.php ├── Update.php └── Where.php ├── Result.php ├── ResultInterface.php └── ResultRow.php /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Smiley 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # chillerlan/php-database 2 | 3 | A PHP SQL client and querybuilder for the most common databases, namely: MySQL, PostgreSQL, SQLite3, Microsoft SQL Server (Transact) and Firebird. 4 | 5 | [![PHP Version Support][php-badge]][php] 6 | [![version][packagist-badge]][packagist] 7 | [![license][license-badge]][license] 8 | [![Continuous Integration][gh-action-badge]][gh-action] 9 | [![Coverage][coverage-badge]][coverage] 10 | [![Packagist downloads][downloads-badge]][downloads] 11 | 12 | [php-badge]: https://img.shields.io/packagist/php-v/chillerlan/php-database?logo=php&color=8892BF&logoColor=fff 13 | [php]: https://www.php.net/supported-versions.php 14 | [packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-database.svg?logo=packagist&logoColor=fff 15 | [packagist]: https://packagist.org/packages/chillerlan/php-database 16 | [license-badge]: https://img.shields.io/github/license/chillerlan/php-database.svg 17 | [license]: https://github.com/chillerlan/php-database/blob/main/LICENSE 18 | [gh-action-badge]: https://img.shields.io/github/actions/workflow/status/chillerlan/php-database/ci.yml?branch=main&logo=github&logoColor=fff 19 | [gh-action]: https://github.com/chillerlan/php-database/actions/workflows/ci.yml?query=branch%3Amain 20 | [coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/php-database.svg?logo=codecov&logoColor=fff 21 | [coverage]: https://codecov.io/github/chillerlan/php-database 22 | [downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-database.svg?logo=packagist&logoColor=fff 23 | [downloads]: https://packagist.org/packages/chillerlan/php-database/stats 24 | 25 | # Documentation 26 | 27 | ## Requirements 28 | - PHP 8.2+ 29 | - one of the supported databases, set up to work with PHP: 30 | - [MySQL](https://dev.mysql.com/doc/refman/5.6/en/) (5.5+) / [MariaDB](https://mariadb.com/kb/en/library/basic-sql-statements/) via [ext-mysqli](https://www.php.net/manual/en/book.mysqli.php) or [ext-pdo_mysql](https://www.php.net/manual/en/ref.pdo-mysql.php) 31 | - [PostgreSQL](https://www.postgresql.org/docs/9.5/static/index.html) (9.5+) via [ext-pgsql](https://www.php.net/manual/en/book.pgsql.php) or [ext-pdo_pgsql](https://www.php.net/manual/en/ref.pdo-pgsql.php) 32 | - [SQLite3](https://www.sqlite.org/lang.html) via [ext-pdo_sqlite](https://www.php.net/manual/en/ref.pdo-sqlite.php) 33 | - [Firebird](https://www.firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25.html) (2.5+) via [ext-pdo_firebird](https://www.php.net/manual/en/ref.pdo-firebird.php) 34 | - [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-downloads) ([transact-sql](https://docs.microsoft.com/sql/t-sql/language-reference)) via [ext-sqlsrv or ext-pdo_sqlsrv](https://github.com/Microsoft/msphpsql) 35 | 36 | ## Installation 37 | **requires [composer](https://getcomposer.org)** 38 | 39 | ### *composer.json* 40 | (note: replace `dev-main` with a [version boundary](https://getcomposer.org/doc/articles/versions.md#summary)) 41 | ```json 42 | { 43 | "require": { 44 | "php": "^8.2", 45 | "chillerlan/php-database": "dev-main" 46 | } 47 | } 48 | ``` 49 | 50 | Profit! 51 | 52 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chillerlan/php-database", 3 | "description": "An extensible database wrapper and query builder.", 4 | "homepage": "https://github.com/chillerlan/php-database", 5 | "license": "MIT", 6 | "type": "library", 7 | "minimum-stability": "dev", 8 | "prefer-stable": true, 9 | "keywords": [ 10 | "database", "query", "builder", "querybuilder", "driver", "mysql", 11 | "postgres", "mariadb", "firebird", "sqlite", "mssql" 12 | ], 13 | "authors": [ 14 | { 15 | "name": "Smiley", 16 | "email": "smiley@chillerlan.net", 17 | "homepage": "https://github.com/codemasher" 18 | } 19 | ], 20 | "support": { 21 | "issues": "https://github.com/chillerlan/php-database/issues", 22 | "source": "https://github.com/chillerlan/php-database" 23 | }, 24 | "require": { 25 | "php": "^8.2", 26 | "ext-json": "*", 27 | "ext-mbstring": "*", 28 | "ext-sodium": "*", 29 | "chillerlan/php-settings-container": "^3.2.1", 30 | "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", 31 | "psr/log": "^1.1 || ^2.0 || ^3.0" 32 | }, 33 | "require-dev": { 34 | "chillerlan/php-dotenv": "^3.0", 35 | "chillerlan/php-cache": "^5.1", 36 | "monolog/monolog": "^3.7", 37 | "phan/phan": "^5.4.5", 38 | "phpunit/phpunit": "^11.3" 39 | }, 40 | "autoload": { 41 | "psr-4": { 42 | "chillerlan\\Database\\": "src" 43 | } 44 | }, 45 | "autoload-dev": { 46 | "psr-4": { 47 | "chillerlan\\DatabaseTest\\": "tests" 48 | } 49 | }, 50 | "scripts": { 51 | "phpunit": "@php vendor/phpunit/phpunit/phpunit", 52 | "phan": "@php vendor/phan/phan/phan" 53 | }, 54 | "config": { 55 | "lock": false, 56 | "sort-packages": true, 57 | "platform-check": true 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /phpdoc.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | .build/phpdocs 10 | .build/phpdocs-cache 11 | 12 | 13 | 14 | 15 | src 16 | tests 17 | 18 | 19 | php 20 | 21 | 22 | 23 | 24 |