diff --git a/README.md b/README.md index def5fea..ea6f91b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -Database logic organisation. - # Database API organisation. Encloses your application's database scripts within a simple and standardised interface, separating database access from your application logic. diff --git a/composer.json b/composer.json index 1a543f4..72cd0cf 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ "phpgt/config": "^1.3", "phpgt/cli": "^2.0", "greenlion/php-sql-parser": "^4.6 || ^5.0", - "phpgt/sqlbuilder": "^1.1" + "phpgt/sqlbuilder": "^1.1", + "phpgt/json": "^2.3.2" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 4d7a77c..950b4f1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0fff117bc14dddc04a32acc373b8f3ed", + "content-hash": "7418d526237dcba417e79a937c7a86ac", "packages": [ { "name": "greenlion/php-sql-parser", @@ -64,19 +64,86 @@ "issues": "https://github.com/greenlion/PHP-SQL-Parser/issues", "source": "https://github.com/greenlion/PHP-SQL-Parser" }, - "time": "2026-09-19T15:22:58+00:00" + "time": "2026-09-19T15:22:58+00:00", + "published-time": "2026-09-22T06:39:50+00:00" + }, + { + "name": "justinrainbow/json-schema", + "version": "6.14.0", + "source": { + "type": "git", + "url": "https://github.com/jsonrainbow/json-schema.git", + "reference": "bae415e135dd68260c2d020ba392850231e9b1ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/bae415e135dd68260c2d020ba392850231e9b1ab", + "reference": "bae415e135dd68260c2d020ba392850231e9b1ab", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-json": "*", + "marc-mabe/php-enum": "^4.4", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "3.3.0", + "json-schema/json-schema-test-suite": "dev-main", + "marc-mabe/php-enum-phpstan": "^2.0", + "phpspec/prophecy": "^1.19", + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "^8.5" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Danny van der Sluijs", + "email": "danny.vandersluijs@icloud.com", + "role": "Maintainer" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/jsonrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "support": { + "issues": "https://github.com/jsonrainbow/json-schema/issues", + "source": "https://github.com/jsonrainbow/json-schema/tree/6.14.0" + }, + "time": "2026-10-24T08:53:34+00:00", + "published-time": "2026-10-24T08:53:38+00:00" }, { "name": "magicalex/write-ini-file", "version": "v1.2.4", "source": { "type": "git", - "url": "https://github.com/Magicalex/WriteiniFile.git", + "url": "https://github.com/al3xLvs/WriteiniFile.git", "reference": "3a933e8222ed2b0ff724c2d4278666fa257e42ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Magicalex/WriteiniFile/zipball/3a933e8222ed2b0ff724c2d4278666fa257e42ac", + "url": "https://api.github.com/repos/al3xLvs/WriteiniFile/zipball/3a933e8222ed2b0ff724c2d4278666fa257e42ac", "reference": "3a933e8222ed2b0ff724c2d4278666fa257e42ac", "shasum": "" }, @@ -115,7 +182,82 @@ "issues": "https://github.com/Magicalex/WriteiniFile/issues", "source": "https://github.com/Magicalex/WriteiniFile/tree/master" }, - "time": "2018-09-09T12:40:38+00:00" + "time": "2018-09-09T12:40:38+00:00", + "published-time": "2018-09-09T12:45:51+00:00" + }, + { + "name": "marc-mabe/php-enum", + "version": "v4.7.2", + "source": { + "type": "git", + "url": "https://github.com/marc-mabe/php-enum.git", + "reference": "bb426fcdd65c60fb3638ef741e8782508fda7eef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/marc-mabe/php-enum/zipball/bb426fcdd65c60fb3638ef741e8782508fda7eef", + "reference": "bb426fcdd65c60fb3638ef741e8782508fda7eef", + "shasum": "" + }, + "require": { + "ext-reflection": "*", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpbench/phpbench": "^0.16.10 || ^1.0.4", + "phpstan/phpstan": "^1.3.1", + "phpunit/phpunit": "^7.5.20 | ^8.5.22 | ^9.5.11", + "vimeo/psalm": "^4.17.0 | ^5.26.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-3.x": "3.2-dev", + "dev-master": "4.7-dev" + } + }, + "autoload": { + "psr-4": { + "MabeEnum\\": "src/" + }, + "classmap": [ + "stubs/Stringable.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Marc Bennewitz", + "email": "dev@mabe.berlin", + "homepage": "https://mabe.berlin/", + "role": "Lead" + } + ], + "description": "Simple and fast implementation of enumerations with native PHP", + "homepage": "https://github.com/marc-mabe/php-enum", + "keywords": [ + "enum", + "enum-map", + "enum-set", + "enumeration", + "enumerator", + "enummap", + "enumset", + "map", + "set", + "type", + "type-hint", + "typehint" + ], + "support": { + "issues": "https://github.com/marc-mabe/php-enum/issues", + "source": "https://github.com/marc-mabe/php-enum/tree/v4.7.2" + }, + "time": "2025-09-14T11:18:39+00:00", + "published-time": "2025-09-14T11:32:17+00:00" }, { "name": "phpgt/cli", @@ -176,7 +318,8 @@ "type": "github" } ], - "time": "2026-11-03T18:19:37+00:00" + "time": "2026-11-03T18:19:37+00:00", + "published-time": "2026-11-12T13:10:55+00:00" }, { "name": "phpgt/config", @@ -234,7 +377,8 @@ "type": "github" } ], - "time": "2026-11-11T10:42:42+00:00" + "time": "2026-11-11T10:42:42+00:00", + "published-time": "2026-11-12T13:11:10+00:00" }, { "name": "phpgt/daemon", @@ -279,7 +423,121 @@ "type": "github" } ], - "time": "2026-11-11T11:12:43+00:00" + "time": "2026-11-11T11:12:43+00:00", + "published-time": "2026-11-12T13:11:06+00:00" + }, + { + "name": "phpgt/dataobject", + "version": "v1.1.2", + "source": { + "type": "git", + "url": "https://github.com/phpgt/DataObject.git", + "reference": "4c6b55ae11555f915969734d9002caa201feda99" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpgt/DataObject/zipball/4c6b55ae11555f915969734d9002caa201feda99", + "reference": "4c6b55ae11555f915969734d9002caa201feda99", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=8.1", + "phpgt/typesafegetter": "^1.3" + }, + "require-dev": { + "phpmd/phpmd": "^2.13", + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.1", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "GT\\DataObject\\": "./src", + "Gt\\DataObject\\": "./src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Greg Bowler", + "email": "greg.bowler@g105b.com" + } + ], + "description": " Structured, type-safe, immutable data transfer.", + "support": { + "issues": "https://github.com/phpgt/DataObject/issues", + "source": "https://github.com/phpgt/DataObject/tree/v1.1.2" + }, + "funding": [ + { + "url": "https://github.com/sponsors/phpgt", + "type": "github" + } + ], + "time": "2026-07-25T17:55:14+00:00", + "published-time": "2026-10-05T10:20:10+00:00" + }, + { + "name": "phpgt/json", + "version": "v2.3.2", + "source": { + "type": "git", + "url": "https://github.com/phpgt/Json.git", + "reference": "4b17764823d749a46ab87b3817ff92f16a3aa0ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpgt/Json/zipball/4b17764823d749a46ab87b3817ff92f16a3aa0ea", + "reference": "4b17764823d749a46ab87b3817ff92f16a3aa0ea", + "shasum": "" + }, + "require": { + "ext-json": "*", + "justinrainbow/json-schema": "^6.1", + "php": ">=8.1", + "phpgt/dataobject": "^1.1" + }, + "require-dev": { + "phpmd/phpmd": "^3.0", + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.1", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "GT\\Json\\": "./src", + "Gt\\Json\\": "./src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Greg Bowler", + "email": "greg.bowler@g105b.com" + } + ], + "description": " Structured, type-safe, immutable JSON objects.", + "support": { + "issues": "https://github.com/phpgt/Json/issues", + "source": "https://github.com/phpgt/Json/tree/v2.3.2" + }, + "funding": [ + { + "url": "https://github.com/sponsors/phpgt", + "type": "github" + } + ], + "time": "2026-11-11T11:14:32+00:00", + "published-time": "2026-11-12T13:11:04+00:00" }, { "name": "phpgt/sqlbuilder", @@ -323,7 +581,8 @@ "type": "github" } ], - "time": "2026-05-06T17:09:03+00:00" + "time": "2026-05-06T17:09:03+00:00", + "published-time": "2026-05-06T17:09:39+00:00" }, { "name": "phpgt/typesafegetter", @@ -376,34 +635,36 @@ "type": "github" } ], - "time": "2026-05-04T15:53:13+00:00" + "time": "2026-05-04T15:53:13+00:00", + "published-time": "2026-05-04T15:50:15+00:00" } ], "packages-dev": [ { "name": "composer/pcre", - "version": "3.3.2", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + "reference": "d5a341b3fb61f3001970940afb1d332968a183ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", - "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "url": "https://api.github.com/repos/composer/pcre/zipball/d5a341b3fb61f3001970940afb1d332968a183ed", + "reference": "d5a341b3fb61f3001970940afb1d332968a183ed", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, "conflict": { - "phpstan/phpstan": "<1.11.10" + "phpstan/phpstan": "<2.2.2" }, "require-dev": { - "phpstan/phpstan": "^1.12 || ^2", - "phpstan/phpstan-strict-rules": "^1 || ^2", - "phpunit/phpunit": "^8 || ^9" + "phpstan/phpstan": "^2", + "phpstan/phpstan-deprecation-rules": "^2", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "^9" }, "type": "library", "extra": { @@ -441,7 +702,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.3.2" + "source": "https://github.com/composer/pcre/tree/3.4.0" }, "funding": [ { @@ -451,13 +712,10 @@ { "url": "https://github.com/composer", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" } ], - "time": "2024-11-12T16:29:46+00:00" + "time": "2026-06-07T11:47:49+00:00", + "published-time": "2026-06-11T12:12:37+00:00" }, { "name": "composer/xdebug-handler", @@ -523,7 +781,8 @@ "type": "tidelift" } ], - "time": "2024-05-06T16:37:16+00:00" + "time": "2024-05-06T16:37:16+00:00", + "published-time": "2024-05-06T17:01:42+00:00" }, { "name": "myclabs/deep-copy", @@ -583,7 +842,8 @@ "type": "github" } ], - "time": "2026-08-11T10:17:44+00:00" + "time": "2026-08-11T10:17:44+00:00", + "published-time": "2026-08-11T10:29:20+00:00" }, { "name": "nikic/php-parser", @@ -640,7 +900,8 @@ "issues": "https://github.com/nikic/PHP-Parser/issues", "source": "https://github.com/nikic/PHP-Parser/tree/v5.9.0" }, - "time": "2026-09-13T18:51:52+00:00" + "time": "2026-09-13T18:51:52+00:00", + "published-time": "2026-09-13T18:53:16+00:00" }, { "name": "pdepend/pdepend", @@ -703,7 +964,8 @@ "type": "tidelift" } ], - "time": "2023-12-17T18:09:59+00:00" + "time": "2023-12-17T18:09:59+00:00", + "published-time": "2023-12-17T18:11:28+00:00" }, { "name": "phar-io/manifest", @@ -770,7 +1032,8 @@ "type": "github" } ], - "time": "2024-03-03T12:33:53+00:00" + "time": "2024-03-03T12:33:53+00:00", + "published-time": "2024-03-03T12:39:44+00:00" }, { "name": "phar-io/version", @@ -821,7 +1084,8 @@ "issues": "https://github.com/phar-io/version/issues", "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2022-02-21T01:04:05+00:00" + "time": "2022-02-21T01:04:05+00:00", + "published-time": "2022-02-21T01:04:30+00:00" }, { "name": "phpmd/phpmd", @@ -904,15 +1168,16 @@ "type": "tidelift" } ], - "time": "2023-12-11T08:22:20+00:00" + "time": "2023-12-11T08:22:20+00:00", + "published-time": "2023-12-11T08:23:00+00:00" }, { "name": "phpstan/phpstan", - "version": "2.3.0", + "version": "2.3.7", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b1f9890d9af53a25c58129e78f0aadd31f90d7f4", - "reference": "b1f9890d9af53a25c58129e78f0aadd31f90d7f4", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/90c91c2498849ab8cc4e873864bbf1cb2bf6ea12", + "reference": "90c91c2498849ab8cc4e873864bbf1cb2bf6ea12", "shasum": "" }, "require": { @@ -968,7 +1233,8 @@ "type": "github" } ], - "time": "2026-10-06T06:15:36+00:00" + "time": "2026-11-19T10:31:11+00:00", + "published-time": "2026-11-19T10:31:27+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1056,7 +1322,8 @@ "type": "tidelift" } ], - "time": "2026-10-03T14:03:50+00:00" + "time": "2026-10-03T14:03:50+00:00", + "published-time": "2026-10-03T14:04:33+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1129,7 +1396,8 @@ "type": "tidelift" } ], - "time": "2026-08-25T14:40:53+00:00" + "time": "2026-08-25T14:40:53+00:00", + "published-time": "2026-08-25T14:41:57+00:00" }, { "name": "phpunit/php-invoker", @@ -1193,7 +1461,8 @@ "type": "github" } ], - "time": "2025-02-07T04:58:58+00:00" + "time": "2025-02-07T04:58:58+00:00", + "published-time": "2025-02-07T04:59:09+00:00" }, { "name": "phpunit/php-text-template", @@ -1265,7 +1534,8 @@ "type": "tidelift" } ], - "time": "2026-10-03T04:51:29+00:00" + "time": "2026-10-03T04:51:29+00:00", + "published-time": "2026-10-03T04:54:39+00:00" }, { "name": "phpunit/php-timer", @@ -1325,20 +1595,21 @@ "type": "github" } ], - "time": "2025-02-07T04:59:38+00:00" + "time": "2025-02-07T04:59:38+00:00", + "published-time": "2025-02-07T04:59:52+00:00" }, { "name": "phpunit/phpunit", - "version": "12.5.38", + "version": "12.5.45", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1e87ad87fe57665a7f6e99a6e467329c11e851cc" + "reference": "ca97be2931de6a0adf824da12889cbf935a016e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1e87ad87fe57665a7f6e99a6e467329c11e851cc", - "reference": "1e87ad87fe57665a7f6e99a6e467329c11e851cc", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ca97be2931de6a0adf824da12889cbf935a016e9", + "reference": "ca97be2931de6a0adf824da12889cbf935a016e9", "shasum": "" }, "require": { @@ -1366,7 +1637,7 @@ "sebastian/object-enumerator": "^7.0.0", "sebastian/recursion-context": "^7.0.1", "sebastian/type": "^6.0.4", - "sebastian/version": "^6.0.1", + "sebastian/version": "^6.0.2", "staabm/side-effects-detector": "^1.0.5" }, "bin": [ @@ -1407,7 +1678,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.38" + "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.45" }, "funding": [ { @@ -1415,7 +1686,8 @@ "type": "other" } ], - "time": "2026-10-05T05:49:30+00:00" + "time": "2026-11-19T12:16:09+00:00", + "published-time": "2026-11-19T12:17:59+00:00" }, { "name": "psr/container", @@ -1468,7 +1740,8 @@ "issues": "https://github.com/php-fig/container/issues", "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:47:00+00:00" + "time": "2021-11-05T16:47:00+00:00", + "published-time": "2021-11-05T16:53:27+00:00" }, { "name": "psr/log", @@ -1518,7 +1791,8 @@ "support": { "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2024-09-11T13:17:53+00:00" + "time": "2024-09-11T13:17:53+00:00", + "published-time": "2024-09-11T13:21:14+00:00" }, { "name": "sebastian/cli-parser", @@ -1587,7 +1861,8 @@ "type": "tidelift" } ], - "time": "2026-05-17T05:29:34+00:00" + "time": "2026-05-17T05:29:34+00:00", + "published-time": "2026-05-17T05:30:34+00:00" }, { "name": "sebastian/comparator", @@ -1679,7 +1954,8 @@ "type": "tidelift" } ], - "time": "2026-05-21T04:45:25+00:00" + "time": "2026-05-21T04:45:25+00:00", + "published-time": "2026-05-21T04:45:36+00:00" }, { "name": "sebastian/complexity", @@ -1737,7 +2013,8 @@ "type": "github" } ], - "time": "2025-02-07T04:55:25+00:00" + "time": "2025-02-07T04:55:25+00:00", + "published-time": "2025-02-07T04:55:36+00:00" }, { "name": "sebastian/diff", @@ -1816,7 +2093,8 @@ "type": "tidelift" } ], - "time": "2026-08-25T15:35:54+00:00" + "time": "2026-08-25T15:35:54+00:00", + "published-time": "2026-08-25T15:37:16+00:00" }, { "name": "sebastian/environment", @@ -1892,7 +2170,8 @@ "type": "tidelift" } ], - "time": "2026-05-25T13:40:20+00:00" + "time": "2026-05-25T13:40:20+00:00", + "published-time": "2026-05-25T13:40:39+00:00" }, { "name": "sebastian/exporter", @@ -1982,7 +2261,8 @@ "type": "tidelift" } ], - "time": "2026-05-20T04:37:17+00:00" + "time": "2026-05-20T04:37:17+00:00", + "published-time": "2026-05-20T04:37:31+00:00" }, { "name": "sebastian/global-state", @@ -2056,7 +2336,8 @@ "type": "tidelift" } ], - "time": "2026-06-01T15:10:33+00:00" + "time": "2026-06-01T15:10:33+00:00", + "published-time": "2026-06-01T15:20:45+00:00" }, { "name": "sebastian/lines-of-code", @@ -2126,7 +2407,8 @@ "type": "tidelift" } ], - "time": "2026-05-19T16:22:07+00:00" + "time": "2026-05-19T16:22:07+00:00", + "published-time": "2026-05-19T16:22:47+00:00" }, { "name": "sebastian/object-enumerator", @@ -2184,7 +2466,8 @@ "type": "github" } ], - "time": "2025-02-07T04:57:48+00:00" + "time": "2025-02-07T04:57:48+00:00", + "published-time": "2025-02-07T04:58:08+00:00" }, { "name": "sebastian/object-reflector", @@ -2240,7 +2523,8 @@ "type": "github" } ], - "time": "2025-02-07T04:58:17+00:00" + "time": "2025-02-07T04:58:17+00:00", + "published-time": "2025-02-07T04:58:28+00:00" }, { "name": "sebastian/recursion-context", @@ -2316,7 +2600,8 @@ "type": "tidelift" } ], - "time": "2025-08-13T04:44:59+00:00" + "time": "2025-08-13T04:44:59+00:00", + "published-time": "2025-08-13T04:45:10+00:00" }, { "name": "sebastian/type", @@ -2385,20 +2670,21 @@ "type": "tidelift" } ], - "time": "2026-05-20T06:45:45+00:00" + "time": "2026-05-20T06:45:45+00:00", + "published-time": "2026-05-20T06:50:13+00:00" }, { "name": "sebastian/version", - "version": "6.0.1", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "9e935a16187e14f39b0e79910dabd614972cdb26" + "reference": "a8b6643a19ba6c8125a473623e45fb8cbb0e4159" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/9e935a16187e14f39b0e79910dabd614972cdb26", - "reference": "9e935a16187e14f39b0e79910dabd614972cdb26", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a8b6643a19ba6c8125a473623e45fb8cbb0e4159", + "reference": "a8b6643a19ba6c8125a473623e45fb8cbb0e4159", "shasum": "" }, "require": { @@ -2431,7 +2717,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/version/tree/6.0.2" }, "funding": [ { @@ -2451,7 +2737,8 @@ "type": "tidelift" } ], - "time": "2026-10-04T05:50:08+00:00" + "time": "2026-11-09T06:30:55+00:00", + "published-time": "2026-11-09T06:31:20+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -2535,7 +2822,8 @@ "type": "thanks_dev" } ], - "time": "2026-08-06T02:45:27+00:00" + "time": "2026-08-06T02:45:27+00:00", + "published-time": "2026-08-06T02:57:35+00:00" }, { "name": "staabm/side-effects-detector", @@ -2587,20 +2875,21 @@ "type": "github" } ], - "time": "2024-10-20T05:08:20+00:00" + "time": "2024-10-20T05:08:20+00:00", + "published-time": "2024-10-20T05:09:39+00:00" }, { "name": "symfony/config", - "version": "v7.4.17", + "version": "v7.4.23", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "696e12da8eea497a1a3808d714b43ff67a7df43e" + "reference": "8ef666abf731e85e59cf478929dda6c7cb2fa9c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/696e12da8eea497a1a3808d714b43ff67a7df43e", - "reference": "696e12da8eea497a1a3808d714b43ff67a7df43e", + "url": "https://api.github.com/repos/symfony/config/zipball/8ef666abf731e85e59cf478929dda6c7cb2fa9c4", + "reference": "8ef666abf731e85e59cf478929dda6c7cb2fa9c4", "shasum": "" }, "require": { @@ -2646,7 +2935,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v7.4.17" + "source": "https://github.com/symfony/config/tree/v7.4.23" }, "funding": [ { @@ -2666,20 +2955,21 @@ "type": "tidelift" } ], - "time": "2026-08-20T09:55:18+00:00" + "time": "2026-11-04T08:27:22+00:00", + "published-time": "2026-11-04T11:27:33+00:00" }, { "name": "symfony/dependency-injection", - "version": "v7.4.20", + "version": "v7.4.23", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "a7faee783a87b55f27460fc571f8c639bf9d93a2" + "reference": "4df0d83a8253d95b222c2f136b9dca3a1a9451a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a7faee783a87b55f27460fc571f8c639bf9d93a2", - "reference": "a7faee783a87b55f27460fc571f8c639bf9d93a2", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/4df0d83a8253d95b222c2f136b9dca3a1a9451a7", + "reference": "4df0d83a8253d95b222c2f136b9dca3a1a9451a7", "shasum": "" }, "require": { @@ -2730,7 +3020,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v7.4.20" + "source": "https://github.com/symfony/dependency-injection/tree/v7.4.23" }, "funding": [ { @@ -2750,20 +3040,21 @@ "type": "tidelift" } ], - "time": "2026-09-29T12:35:16+00:00" + "time": "2026-11-01T17:38:00+00:00", + "published-time": "2026-11-04T11:27:44+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.7.1", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d" + "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d", - "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/feb1edf4e546af3b85c5caebe8359a20db230ca3", + "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3", "shasum": "" }, "require": { @@ -2776,7 +3067,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -2801,7 +3092,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.8.1" }, "funding": [ { @@ -2821,20 +3112,21 @@ "type": "tidelift" } ], - "time": "2026-06-05T06:23:12+00:00" + "time": "2026-09-16T14:15:10+00:00", + "published-time": "2026-11-04T11:25:34+00:00" }, { "name": "symfony/filesystem", - "version": "v7.4.18", + "version": "v7.4.23", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "90d412aa5277c6819db39e7605aa46b1019e3232" + "reference": "53d609da66578dad5a39fe290e8f924ec8f05e93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/90d412aa5277c6819db39e7605aa46b1019e3232", - "reference": "90d412aa5277c6819db39e7605aa46b1019e3232", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/53d609da66578dad5a39fe290e8f924ec8f05e93", + "reference": "53d609da66578dad5a39fe290e8f924ec8f05e93", "shasum": "" }, "require": { @@ -2871,7 +3163,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.4.18" + "source": "https://github.com/symfony/filesystem/tree/v7.4.23" }, "funding": [ { @@ -2891,7 +3183,8 @@ "type": "tidelift" } ], - "time": "2026-08-23T10:03:40+00:00" + "time": "2026-11-04T08:27:22+00:00", + "published-time": "2026-11-04T11:28:00+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2974,20 +3267,21 @@ "type": "tidelift" } ], - "time": "2026-04-10T16:19:22+00:00" + "time": "2026-04-10T16:19:22+00:00", + "published-time": "2026-04-26T14:44:50+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.43.0", + "version": "v1.43.3", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "4d5d331bf731e0aedbc6b2f5e61135b7b7996a72" + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/4d5d331bf731e0aedbc6b2f5e61135b7b7996a72", - "reference": "4d5d331bf731e0aedbc6b2f5e61135b7b7996a72", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/122889ed24dc000165bcbfd77ec412f15cbdfc6a", + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a", "shasum": "" }, "require": { @@ -3039,7 +3333,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.43.3" }, "funding": [ { @@ -3059,20 +3353,21 @@ "type": "tidelift" } ], - "time": "2026-09-24T15:19:04+00:00" + "time": "2026-10-28T09:35:49+00:00", + "published-time": "2026-10-28T10:07:45+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.7.3", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257" + "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", - "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/052852a96fd5e5ebdb617dba22031e41a3300fb5", + "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5", "shasum": "" }, "require": { @@ -3090,7 +3385,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -3126,7 +3421,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.7.3" + "source": "https://github.com/symfony/service-contracts/tree/v3.8.1" }, "funding": [ { @@ -3146,7 +3441,8 @@ "type": "tidelift" } ], - "time": "2026-07-27T15:39:01+00:00" + "time": "2026-10-20T17:38:25+00:00", + "published-time": "2026-11-04T11:25:33+00:00" }, { "name": "symfony/var-exporter", @@ -3226,7 +3522,8 @@ "type": "tidelift" } ], - "time": "2026-07-29T16:27:17+00:00" + "time": "2026-07-29T16:27:17+00:00", + "published-time": "2026-07-29T21:45:50+00:00" }, { "name": "theseer/tokenizer", @@ -3276,7 +3573,8 @@ "type": "github" } ], - "time": "2025-12-08T11:19:18+00:00" + "time": "2025-12-08T11:19:18+00:00", + "published-time": "2025-12-08T11:19:39+00:00" } ], "aliases": [], @@ -3294,5 +3592,5 @@ "platform-overrides": { "php": "8.4.0" }, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.11.0" } diff --git a/logo.png b/logo.png deleted file mode 100644 index b2470a7..0000000 Binary files a/logo.png and /dev/null differ diff --git a/phpmd.xml b/phpmd.xml index 3067481..f1b64a4 100644 --- a/phpmd.xml +++ b/phpmd.xml @@ -1,5 +1,5 @@ -format("Y-m-d H:i:s"); } + elseif($value instanceof Stringable) { + $bindings[$key] = (string)$value; + } if(is_array($value)) { foreach($value as $i => $innerValue) { $newKey = $key . "__" . $i; diff --git a/src/Result/Row.php b/src/Result/Row.php index e055d51..8150b8b 100644 --- a/src/Result/Row.php +++ b/src/Result/Row.php @@ -2,6 +2,9 @@ namespace GT\Database\Result; use DateTime; +use GT\Json\JSONDecodeException; +use GT\Json\JSONObject; +use GT\Json\JSONObjectBuilder; use Iterator; /** @implements Iterator */ @@ -47,6 +50,19 @@ public function getBool(string $columnName):?bool { return $this->getAsNullablePrimitive($columnName, "bool"); } + /** + * Missing columns and SQL NULL return null; JSON null remains a JSON value. + * @throws JSONDecodeException + */ + public function getJson(string $columnName):?JSONObject { + $value = $this->getString($columnName); + if(is_null($value)) { + return null; + } + + return (new JSONObjectBuilder())->fromJsonString($value); + } + public function getDateTime(string $columnName):?DateTime { $dateString = $this->data[$columnName] ?? null; if(is_null($dateString)) { diff --git a/test/phpunit/Query/QueryTest.php b/test/phpunit/Query/QueryTest.php index dd99285..71af65c 100644 --- a/test/phpunit/Query/QueryTest.php +++ b/test/phpunit/Query/QueryTest.php @@ -1,15 +1,58 @@ getMockBuilder(Query::class)->onlyMethods(["getSql"])->getMock(); + $query->expects(self::never())->method("getSql"); + $value = new class implements Stringable { + public function __toString():string { + return "example's value"; + } + }; + + self::assertSame(["value" => "example's value"], $query->prepareBindings(["value" => $value])); + self::assertSame(["example's value"], $query->prepareBindings([$value])); + } + + public function testPrepareBindingsJsonObject():void { + $query = $this->getMockBuilder(Query::class)->onlyMethods(["getSql"])->getMock(); + $query->expects(self::never())->method("getSql"); + $json = (new JSONObjectBuilder())->fromJsonString('{"tags":["one","two"]}'); + + self::assertSame( + ["settings" => '{"tags":["one","two"]}'], + $query->prepareBindings(["settings" => $json]), + ); + } + + public function testPrepareBindingsDateTimeFormattingTakesPrecedence():void { + $query = $this->getMockBuilder(Query::class)->onlyMethods(["getSql"])->getMock(); + $query->expects(self::never())->method("getSql"); + $date = new class("2026-11-18 12:34:56") extends DateTimeImmutable implements Stringable { + public function __toString():string { + return "custom date representation"; + } + }; + + self::assertSame( + ["date" => "2026-11-18 12:34:56"], + $query->prepareBindings(["date" => $date]), + ); + } + #[\PHPUnit\Framework\Attributes\DataProviderExternal(\GT\Database\Test\Helper\Helper::class, "queryPathNotExistsProvider")] public function testConstructionQueryPathNotExists( string $queryName, diff --git a/test/phpunit/Result/RowTest.php b/test/phpunit/Result/RowTest.php index 623f5fa..1e874a1 100644 --- a/test/phpunit/Result/RowTest.php +++ b/test/phpunit/Result/RowTest.php @@ -3,10 +3,78 @@ use DateTime; use GT\Database\Result\Row; +use GT\Json\JSONDecodeException; +use GT\Json\JSONKvpObject; +use GT\Json\JSONPrimitive\JSONArrayPrimitive; +use GT\Json\JSONPrimitive\JSONBoolPrimitive; +use GT\Json\JSONPrimitive\JSONFloatPrimitive; +use GT\Json\JSONPrimitive\JSONIntPrimitive; +use GT\Json\JSONPrimitive\JSONNullPrimitive; +use GT\Json\JSONPrimitive\JSONStringPrimitive; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class RowTest extends TestCase { - #[\PHPUnit\Framework\Attributes\DataProvider("data_getTestRow")] + public function testGetJsonObject():void { + $value = '{"name":"Example","count":3,"enabled":true,"tags":["one","two"]}'; + $row = new Row(["settings" => $value]); + $json = $row->getJson("settings"); + + self::assertInstanceOf(JSONKvpObject::class, $json); + self::assertSame("Example", $json->getString("name")); + self::assertSame(3, $json->getInt("count")); + self::assertTrue($json->getBool("enabled")); + self::assertSame(["one", "two"], $json->getArray("tags", "string")); + self::assertSame($value, $row->getString("settings")); + } + + public function testGetJsonEmptyObject():void { + $row = new Row(["settings" => "{}"]); + self::assertInstanceOf(JSONKvpObject::class, $row->getJson("settings")); + } + + #[DataProvider("jsonPrimitives")] + public function testGetJsonPrimitive(string $value, string $type, mixed $expected):void { + $row = new Row(["value" => $value]); + $json = $row->getJson("value"); + + self::assertInstanceOf($type, $json); + self::assertSame($expected, $json->getPrimitiveValue()); + } + + public static function jsonPrimitives():iterable { + yield "array" => ['["one","two"]', JSONArrayPrimitive::class, ["one", "two"]]; + yield "empty array" => ["[]", JSONArrayPrimitive::class, []]; + yield "integer" => ["123", JSONIntPrimitive::class, 123]; + yield "zero" => ["0", JSONIntPrimitive::class, 0]; + yield "float" => ["1.25", JSONFloatPrimitive::class, 1.25]; + yield "true" => ["true", JSONBoolPrimitive::class, true]; + yield "false" => ["false", JSONBoolPrimitive::class, false]; + yield "string" => ['"example"', JSONStringPrimitive::class, "example"]; + yield "empty string" => ['""', JSONStringPrimitive::class, ""]; + yield "JSON null" => ["null", JSONNullPrimitive::class, null]; + } + + public function testGetJsonNullable():void { + $row = new Row(["value" => null]); + self::assertNull($row->getJson("value")); + self::assertNull($row->getJson("missing")); + } + + #[DataProvider("invalidJson")] + public function testGetJsonInvalid(string $value):void { + $row = new Row(["value" => $value]); + self::expectException(JSONDecodeException::class); + $row->getJson("value"); + } + + public static function invalidJson():iterable { + yield "empty column" => [""]; + yield "malformed JSON" => ['{"incomplete":']; + yield "invalid UTF-8" => ["\"\xB1\""]; + } + + #[DataProvider("data_getTestRow")] public function testFieldAccess(array $data) { $row = new Row($data); @@ -68,7 +136,7 @@ public function testGetFieldList() { ); } - #[\PHPUnit\Framework\Attributes\DataProvider("data_getTestRow")] + #[DataProvider("data_getTestRow")] public function testIteration(array $data) { $row = new Row($data); @@ -82,7 +150,7 @@ public function testIteration(array $data) { } } - #[\PHPUnit\Framework\Attributes\DataProvider("data_getTestRow")] + #[DataProvider("data_getTestRow")] public function testGetString(array $data) { $row = new Row($data); foreach($data as $key => $expected) { @@ -92,7 +160,7 @@ public function testGetString(array $data) { } } - #[\PHPUnit\Framework\Attributes\DataProvider("data_getTestRow")] + #[DataProvider("data_getTestRow")] public function testGetInt(array $data) { $row = new Row($data); $id = $row->getInt("id"); @@ -100,7 +168,7 @@ public function testGetInt(array $data) { self::assertSame((int)$data["id"], $id); } - #[\PHPUnit\Framework\Attributes\DataProvider("data_getTestRow")] + #[DataProvider("data_getTestRow")] public function testGetFloat(array $data) { $row = new Row($data); $float = $row->getFloat("exampleFloat"); @@ -108,7 +176,7 @@ public function testGetFloat(array $data) { self::assertSame(round($data["exampleFloat"], 4), round($float, 4)); } - #[\PHPUnit\Framework\Attributes\DataProvider("data_getTestRow")] + #[DataProvider("data_getTestRow")] public function testGetBool(array $data) { $row = new Row($data); $bool = $row->getBool("exampleBool"); @@ -116,7 +184,7 @@ public function testGetBool(array $data) { self::assertSame((bool)$data["exampleBool"], $bool); } - #[\PHPUnit\Framework\Attributes\DataProvider("data_getTestRow")] + #[DataProvider("data_getTestRow")] public function testGetDateTime(array $data) { $row = new Row($data); $dateTime = $row->getDateTime("exampleDateTime"); @@ -127,7 +195,7 @@ public function testGetDateTime(array $data) { ); } - #[\PHPUnit\Framework\Attributes\DataProvider("timestamps")] + #[DataProvider("timestamps")] public function testGetDateTime_timestamp(string $timestamp):void { $sut = new Row(["date" => $timestamp]); $dateTime = $sut->getDateTime("date");