From 8075c6cf59bea2808e30ec1703d753ffbc34a9ef Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Mon, 13 Jul 2026 08:35:09 -0400 Subject: [PATCH 1/4] Upgrade to byjg/micro-orm 7.0 and anydataset-db 7.0 - Bump byjg/micro-orm to ^7.0 (pulls byjg/anydataset-db ^7.0) - Migrate test DDL from removed $dbDriver->execute() to DatabaseExecutor - Replace deprecated Factory::getDbRelationalInstance with getDbInstance - Update dev dependencies: phpunit ^12.5, psalm ^6.13 - Add CHANGELOG-7.0.md --- CHANGELOG-7.0.md | 78 +++++++++++++++++++ composer.json | 6 +- tests/PasswordMd5MapperTest.php | 6 +- ...UsersDBDataset2ByUserNameTestUsersBase.php | 8 +- .../UsersDBDatasetByUsernameTestUsersBase.php | 6 +- tests/UsersDBDatasetDefinitionTest.php | 6 +- 6 files changed, 94 insertions(+), 16 deletions(-) create mode 100644 CHANGELOG-7.0.md diff --git a/CHANGELOG-7.0.md b/CHANGELOG-7.0.md new file mode 100644 index 0000000..cf1baea --- /dev/null +++ b/CHANGELOG-7.0.md @@ -0,0 +1,78 @@ +# Changelog - Version 7.0 + +## Overview + +Version 7.0 upgrades the underlying persistence stack to `byjg/micro-orm` 7.0 and +`byjg/anydataset-db` 7.0. The AuthUser public API is **unchanged**: `UsersService`, +`UsersRepository`, `UserPropertiesRepository`, models, enums and mapper interfaces keep the exact +same signatures as 6.x. + +Since 6.0 the library was already wired exclusively through `DatabaseExecutor` — the API that +became mandatory in anydataset-db 7.0 — so no library code had to change beyond the dependency +constraints. + +## Breaking Changes + +### Dependencies + +| Package | 6.x | 7.0 | +|---|---|---| +| `byjg/micro-orm` | `^6.0` | `^7.0` | +| `byjg/anydataset-db` (transitive) | `^6.0` | `^7.0` | + +### Removed driver query methods (via anydataset-db 7.0) + +The query methods deprecated on the drivers since anydataset-db 6.0 no longer exist +(`$dbDriver->execute()`, `getIterator()`, `getScalar()`, `executeAndGetId()`, `getAllFields()`). +If your application still calls them on the driver instance it passes to AuthUser, migrate to: + +```php +execute($sql, $params); +``` + +The recommended wiring is unchanged and keeps working as-is: + +```php +=8.3 <8.6", - "byjg/micro-orm": "^6.0", + "byjg/micro-orm": "^7.0", "byjg/cache-engine": "^6.0", "byjg/jwt-wrapper": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^10.5|^11.5", - "vimeo/psalm": "^5.9|^6.13" + "phpunit/phpunit": "^12.5", + "vimeo/psalm": "^6.13" }, "scripts": { "test": "vendor/bin/phpunit", diff --git a/tests/PasswordMd5MapperTest.php b/tests/PasswordMd5MapperTest.php index 6257082..ab20070 100644 --- a/tests/PasswordMd5MapperTest.php +++ b/tests/PasswordMd5MapperTest.php @@ -25,7 +25,8 @@ class PasswordMd5MapperTest extends TestCase public function setUp(): void { $this->db = Factory::getDbInstance(self::CONNECTION_STRING); - $this->db->execute('create table users ( + $executor = DatabaseExecutor::using($this->db); + $executor->execute('create table users ( userid integer primary key autoincrement, name varchar(45), email varchar(200), @@ -37,7 +38,7 @@ public function setUp(): void role varchar(20));' ); - $this->db->execute('create table users_property ( + $executor->execute('create table users_property ( id integer primary key autoincrement, userid integer, name varchar(45), @@ -45,7 +46,6 @@ public function setUp(): void ); // Create repositories and service with custom MD5 password mapper via UserModelMd5 - $executor = DatabaseExecutor::using($this->db); $usersRepository = new UsersRepository($executor, UserModelMd5::class); $propertiesRepository = new UserPropertiesRepository($executor, UserPropertiesModel::class); $this->service = new UsersService( diff --git a/tests/UsersDBDataset2ByUserNameTestUsersBase.php b/tests/UsersDBDataset2ByUserNameTestUsersBase.php index 25c9687..5622d87 100644 --- a/tests/UsersDBDataset2ByUserNameTestUsersBase.php +++ b/tests/UsersDBDataset2ByUserNameTestUsersBase.php @@ -22,8 +22,9 @@ public function __setUp($loginField) $this->prefix = ""; $this->loginField = $loginField; - $this->db = Factory::getDbRelationalInstance(self::CONNECTION_STRING); - $this->db->execute('create table mytable ( + $this->db = Factory::getDbInstance(self::CONNECTION_STRING); + $executor = DatabaseExecutor::using($this->db); + $executor->execute('create table mytable ( myuserid integer primary key autoincrement, myname varchar(45), myemail varchar(200), @@ -35,14 +36,13 @@ public function __setUp($loginField) myrole varchar(20));' ); - $this->db->execute('create table theirproperty ( + $executor->execute('create table theirproperty ( theirid integer primary key autoincrement, theiruserid integer, theirname varchar(45), theirvalue varchar(45));' ); - $executor = DatabaseExecutor::using($this->db); $usersRepository = new UsersRepository($executor, CustomUserModel::class); $propertiesRepository = new UserPropertiesRepository($executor, CustomUserPropertiesModel::class); $this->object = new UsersService( diff --git a/tests/UsersDBDatasetByUsernameTestUsersBase.php b/tests/UsersDBDatasetByUsernameTestUsersBase.php index 4a5b266..3c9f2e1 100644 --- a/tests/UsersDBDatasetByUsernameTestUsersBase.php +++ b/tests/UsersDBDatasetByUsernameTestUsersBase.php @@ -26,7 +26,8 @@ public function __setUp($loginField) $this->loginField = $loginField; $this->db = Factory::getDbInstance(self::CONNECTION_STRING); - $this->db->execute('create table users ( + $executor = DatabaseExecutor::using($this->db); + $executor->execute('create table users ( userid integer primary key autoincrement, name varchar(45), email varchar(200), @@ -38,14 +39,13 @@ public function __setUp($loginField) role varchar(20));' ); - $this->db->execute('create table users_property ( + $executor->execute('create table users_property ( id integer primary key autoincrement, userid integer, name varchar(45), value varchar(45));' ); - $executor = DatabaseExecutor::using($this->db); $usersRepository = new UsersRepository($executor, UserModel::class); $propertiesRepository = new UserPropertiesRepository($executor, UserPropertiesModel::class); $this->object = new UsersService( diff --git a/tests/UsersDBDatasetDefinitionTest.php b/tests/UsersDBDatasetDefinitionTest.php index e3479d5..de544ca 100644 --- a/tests/UsersDBDatasetDefinitionTest.php +++ b/tests/UsersDBDatasetDefinitionTest.php @@ -38,7 +38,8 @@ public function __setUp($loginField) $this->loginField = $loginField; $this->db = Factory::getDbInstance(self::CONNECTION_STRING); - $this->db->execute('create table mytable ( + $executor = DatabaseExecutor::using($this->db); + $executor->execute('create table mytable ( myuserid integer primary key autoincrement, myname varchar(45), myemail varchar(200), @@ -51,14 +52,13 @@ public function __setUp($loginField) myrole varchar(20));' ); - $this->db->execute('create table theirproperty ( + $executor->execute('create table theirproperty ( theirid integer primary key autoincrement, theiruserid integer, theirname varchar(45), theirvalue varchar(45));' ); - $executor = DatabaseExecutor::using($this->db); $usersRepository = new UsersRepository($executor, MyUserModel::class); $propertiesRepository = new UserPropertiesRepository($executor, MyUserPropertiesModel::class); $this->object = new UsersService( From 64642854543177f7456a01d99fa4a270438b22fd Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Mon, 10 Aug 2026 23:12:04 -0400 Subject: [PATCH 2/4] Bump byjg/cache-engine to ^7.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b2eb45f..a00abf6 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "require": { "php": ">=8.3 <8.6", "byjg/micro-orm": "^7.0", - "byjg/cache-engine": "^6.0", + "byjg/cache-engine": "^7.0", "byjg/jwt-wrapper": "^6.0" }, "require-dev": { From 7e0c0fa03fee13b5df960c1b19dd280c4540fde2 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Sun, 23 Aug 2026 23:34:09 -0400 Subject: [PATCH 3/4] Prepare 7.0: PHP 8.3-8.6, PHPUnit 12.5, Psalm as a tool Widen the PHP constraint to ">=8.3 <8.7"; the previous "<8.6" is exclusive and excluded PHP 8.6. Bump byjg/* dependencies to ^7.0. While 7.0 is unreleased these resolve to 7.0.x-dev from each component's 7.0 branch, via minimum-stability dev with prefer-stable. Pin PHPUnit to ^12.5 and move Psalm to tools/psalm/composer.json. Psalm enumerates supported PHP versions and no release lists 8.6, so as a require-dev it made "composer install" fail on the 8.6 build before any test ran. "composer psalm" bootstraps the tool and runs it. CI: add PHP 8.6 to the matrix; the Psalm job runs on 8.5. Housekeeping: rename phpunit.xml.dist to phpunit.xml, carry the 6.0 changelog onto this branch, and update CHANGELOG-7.0.md. --- .github/workflows/phpunit.yml | 10 +++++++-- CHANGELOG-7.0.md | 38 +++++++++++++++++++++++++++++++++ composer.json | 12 ++++++----- phpunit.xml.dist => phpunit.xml | 0 psalm.xml | 2 +- tools/psalm/composer.json | 5 +++++ 6 files changed, 59 insertions(+), 8 deletions(-) rename phpunit.xml.dist => phpunit.xml (100%) create mode 100644 tools/psalm/composer.json diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index fc5f29a..4dca2b0 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -18,6 +18,7 @@ jobs: strategy: matrix: php-version: + - "8.6" - "8.5" - "8.4" - "8.3" @@ -34,7 +35,7 @@ jobs: # for github/codeql-action/upload-sarif to upload SARIF results security-events: write container: - image: byjg/php:8.4-cli + image: byjg/php:8.5-cli options: --user root --privileged steps: @@ -44,10 +45,15 @@ jobs: - name: Composer run: composer install + - name: Composer (psalm) + + run: composer --working-dir=tools/psalm update --no-interaction + + - name: Psalm # Note: Ignoring error code 2, which just signals that some # flaws were found, not that Psalm itself failed to run. - run: ./vendor/bin/psalm + run: ./tools/psalm/vendor/bin/psalm --show-info=true --report=psalm-results.sarif || [ $? = 2 ] diff --git a/CHANGELOG-7.0.md b/CHANGELOG-7.0.md index cf1baea..b917c5b 100644 --- a/CHANGELOG-7.0.md +++ b/CHANGELOG-7.0.md @@ -76,3 +76,41 @@ observers are now scoped per executor instead of global. 3. If you still call the removed query methods directly on the `DbDriverInterface` instance, migrate those calls to `DatabaseExecutor` (see table in the [anydataset-db 7.0 changelog](https://github.com/byjg/anydataset-db/blob/master/CHANGELOG-7.0.md)). + +## Requirements + +- PHP 8.3, 8.4, 8.5 and 8.6 are now supported: `"php": ">=8.3 <8.7"`. + The previous `<8.6` upper bound excluded PHP 8.6, since `<8.6` is exclusive. + +### ByJG dependencies + +- `byjg/cache-engine` is now `^7.0`. +- `byjg/jwt-wrapper` is now `^7.0`. +- `byjg/micro-orm` is now `^7.0`. + +While 7.0 is unreleased these resolve to `7.0.x-dev` from each component's +`7.0` branch, via `minimum-stability: dev` with `prefer-stable: true`. + +## Toolchain + +- PHPUnit updated to `^12.5`. +- Psalm moved out of `require-dev` into its own manifest, `tools/psalm/composer.json`. + + Psalm enumerates the PHP versions it supports and no published release lists + 8.6. As a dev dependency it made `composer install` fail on the 8.6 build job + before any test ran. It now installs separately, only for the Psalm job. + + `composer psalm` still works — it bootstraps the tool and runs it. + +- PHPUnit 13 is deliberately **not** used. It requires PHP `>=8.4.1`, breaking the + 8.3 floor, and needs `sebastian/diff ^9.0`, which stable Psalm 6.16.1 rejects — + a combination that silently resolves Psalm to an unreleased `6.x-dev` branch. + +## Continuous Integration + +- The build matrix now includes PHP 8.6. +- The Psalm job runs on PHP 8.5 and installs Psalm from `tools/psalm`. + +## Housekeeping + +- `phpunit.xml.dist` renamed to `phpunit.xml`. diff --git a/composer.json b/composer.json index a00abf6..7f0c26c 100644 --- a/composer.json +++ b/composer.json @@ -14,18 +14,20 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": ">=8.3 <8.6", + "php": ">=8.3 <8.7", "byjg/micro-orm": "^7.0", "byjg/cache-engine": "^7.0", - "byjg/jwt-wrapper": "^6.0" + "byjg/jwt-wrapper": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^12.5", - "vimeo/psalm": "^6.13" + "phpunit/phpunit": "^12.5" }, "scripts": { "test": "vendor/bin/phpunit", - "psalm": "vendor/bin/psalm --threads=1" + "psalm": [ + "@composer --working-dir=tools/psalm update --no-interaction", + "tools/psalm/vendor/bin/psalm --threads=1" + ] }, "license": "MIT" } diff --git a/phpunit.xml.dist b/phpunit.xml similarity index 100% rename from phpunit.xml.dist rename to phpunit.xml diff --git a/psalm.xml b/psalm.xml index 037de8b..c1976fd 100644 --- a/psalm.xml +++ b/psalm.xml @@ -7,7 +7,7 @@ cacheDirectory="/tmp/psalm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" - xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + xsi:schemaLocation="https://getpsalm.org/schema/config tools/psalm/vendor/vimeo/psalm/config.xsd" > diff --git a/tools/psalm/composer.json b/tools/psalm/composer.json new file mode 100644 index 0000000..197dd5f --- /dev/null +++ b/tools/psalm/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "vimeo/psalm": "^6.16" + } +} From 725acb16b525c1f3443be6cec2766d9917bf169d Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Mon, 14 Sep 2026 12:08:00 -0400 Subject: [PATCH 4/4] Fix the license badge link and drop the hand-written dependency graph licensing.html returns 404; the page is /license/. The Dependencies mermaid drifted from composer.json, which is now what the site's graph is built from (collect-deps.py in add-doc). --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index db477b9..98e2abb 100644 --- a/README.md +++ b/README.md @@ -128,14 +128,5 @@ Because this project uses PHP Session you need to run the unit test the followin This project is licensed under the MIT License - see the [LICENSE](https://github.com/byjg/php-authuser/blob/master/LICENSE) file for details. -## Dependencies - -```mermaid -flowchart TD - byjg/authuser --> byjg/micro-orm - byjg/authuser --> byjg/cache-engine - byjg/authuser --> byjg/jwt-wrapper -``` - ---- [Open source ByJG](http://opensource.byjg.com)