diff --git a/README.md b/README.md index 3e0d168..829c637 100644 --- a/README.md +++ b/README.md @@ -32,55 +32,55 @@ layers the bridge's wiring on top of PhpDb's. 1. Install the package: -```bash -composer require webware/webware-phpdb -``` + ```bash + composer require webware/webware-phpdb + ``` 2. Merge its providers in the consumer's config aggregator: -```php -use Laminas\ConfigAggregator\ConfigAggregator; - -$aggregator = new ConfigAggregator([ - PhpDb\ConfigProvider::class, - PhpDb\WebwareProvider::class, - // ... - Mezzio\Session\ConfigProvider::class, - // After every provider that declares SessionPersistenceInterface: - // it re-points that alias at the database persistence. - PhpDb\Session\SessionProvider::class, -]); -``` + ```php + use Laminas\ConfigAggregator\ConfigAggregator; + + $aggregator = new ConfigAggregator([ + PhpDb\ConfigProvider::class, + PhpDb\WebwareProvider::class, + // ... + Mezzio\Session\ConfigProvider::class, + // After every provider that declares SessionPersistenceInterface: + // it re-points that alias at the database persistence. + PhpDb\Session\SessionProvider::class, + ]); + ``` -`PhpDb\WebwareProvider` shares no config keys with `PhpDb\ConfigProvider`, so their relative order -does not change the merged result. `SessionProvider` is the one with an ordering requirement. + `PhpDb\WebwareProvider` shares no config keys with `PhpDb\ConfigProvider`, so their relative order + does not change the merged result. `SessionProvider` is the one with an ordering requirement. 3. Build table identifiers from a schema enum, so raw table names stay out of the application layer: -```php -use PhpDb\SchemaFactory; -use PhpDb\SchemaInterface; + ```php + use PhpDb\SchemaFactory; + use PhpDb\SchemaInterface; -enum WebwareSchema: string implements SchemaInterface -{ - public const string NAME = 'webware'; + enum WebwareSchema: string implements SchemaInterface + { + public const string NAME = 'webware'; - case Session = 'session'; -} + case Session = 'session'; + } -$factory = $container->get(SchemaFactory::class); -$identifier = $factory(WebwareSchema::Session); + $factory = $container->get(SchemaFactory::class); + $identifier = $factory(WebwareSchema::Session); -$identifier->getTable(); // 'session' until a prefix is configured -$identifier->getSchema(); // 'webware' -``` + $identifier->getTable(); // 'session' until a prefix is configured + $identifier->getSchema(); // 'webware' + ``` 4. Create the session table, and let Mezzio session middleware use it: -```bash -vendor/bin/webware session:init-db -``` + ```bash + vendor/bin/webware session:init-db + ``` With `SessionProvider` merged, `Mezzio\Session\SessionPersistenceInterface` resolves to `PhpDb\Session\PhpDbSessionPersistence`, which reads and writes that table. diff --git a/composer.json b/composer.json index 3d78b83..e951e3a 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "roave/security-advisories": "dev-master", "webware/webware-console": "1.0.x-dev", "webware/webware-event": "1.0.0-alpha.5", - "webware/webware-tools": "^1.0.0-rc.14" + "webware/webware-tools": "^1.1.0" }, "suggest": { "mezzio/mezzio-session": "Required to use the database-backed session persistence", diff --git a/composer.lock b/composer.lock index 9f8e7bc..3f89885 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": "6e47d2fa98f22b1a21118414621d37a7", + "content-hash": "82c00556214ce7d881f2dc5a0574db41", "packages": [ { "name": "brick/varexporter", @@ -10973,20 +10973,20 @@ }, { "name": "webware/webware-tools", - "version": "1.0.0-rc.14", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/webinertia/webware-tools.git", - "reference": "8093557960cc9d1415bc0f8a674da752907bfcb3" + "reference": "eed58893e24afb25851274c6edff8183859e50d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webinertia/webware-tools/zipball/8093557960cc9d1415bc0f8a674da752907bfcb3", - "reference": "8093557960cc9d1415bc0f8a674da752907bfcb3", + "url": "https://api.github.com/repos/webinertia/webware-tools/zipball/eed58893e24afb25851274c6edff8183859e50d4", + "reference": "eed58893e24afb25851274c6edff8183859e50d4", "shasum": "" }, "require": { - "php": "~8.4.0 || ~8.5.0" + "php": "~8.4.0 || ~8.5.0 || ~8.6.0" }, "require-dev": { "roave/security-advisories": "dev-master" @@ -11011,10 +11011,10 @@ ], "support": { "issues": "https://github.com/webinertia/webware-tools/issues", - "source": "https://github.com/webinertia/webware-tools/tree/1.0.0-rc.14" + "source": "https://github.com/webinertia/webware-tools/tree/1.1.0" }, - "time": "2026-11-13T09:23:54+00:00", - "published-time": "2026-11-13T13:26:52+00:00" + "time": "2026-11-22T07:25:33+00:00", + "published-time": "2026-11-22T07:25:58+00:00" } ], "aliases": [], @@ -11030,7 +11030,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "~8.4.1 || ~8.5.0" + "php": "~8.4.1 || ~8.5.0 || ~8.6.0" }, "platform-dev": {}, "platform-overrides": { diff --git a/docs/v1/schema-factory.md b/docs/v1/schema-factory.md index b91c798..db1e87d 100644 --- a/docs/v1/schema-factory.md +++ b/docs/v1/schema-factory.md @@ -158,4 +158,4 @@ that a table belongs to the connection's default schema. An empty value in configuration never reaches `TableIdentifier`: the shape assertion rejects it while `SchemaFactory` is constructed, so only a call-time override can produce `InvalidArgumentException` from the identifier itself. The shape is closed, so an unrecognized key -such as `prefx` fails at construction rather than being ignored. \ No newline at end of file +such as `prefx` fails at construction rather than being ignored. diff --git a/markdownlint-cli2.jsonc b/markdownlint-cli2.jsonc new file mode 100644 index 0000000..024d658 --- /dev/null +++ b/markdownlint-cli2.jsonc @@ -0,0 +1,19 @@ +// markdownlint-cli2 configuration for aligned packages. +// +// Formatting consistency for documentation: every default rule except two. +// +// Off by design: +// MD013 line-length - 1588 findings in webware-console alone, and prose +// wrapping is not structural consistency +// MD060 table-column-style - alignment padding, same reasoning +// +// The required workflow runs this by name as the `markdown` job. +{ + "config": { + "default": true, + "MD013": false, + "MD060": false + }, + "globs": ["**/*.md"], + "ignores": ["vendor/**", "node_modules/**"] +} diff --git a/src/Session/Sql/Insert.php b/src/Session/Sql/Insert.php index afd4912..5a7a10f 100644 --- a/src/Session/Sql/Insert.php +++ b/src/Session/Sql/Insert.php @@ -31,11 +31,12 @@ final class Insert extends BaseInsert { protected array $specifications = [ - self::SPECIFICATION_INSERT => 'INSERT INTO %1$s (%2$s) VALUES (%3$s)' - . ' ON DUPLICATE KEY UPDATE' - . ' payload = VALUES(payload)' - . ', expires_at = VALUES(expires_at)' - . ', modified_at = VALUES(modified_at)', + self::SPECIFICATION_INSERT => + 'INSERT INTO %1$s (%2$s) VALUES (%3$s)' + . ' ON DUPLICATE KEY UPDATE' + . ' payload = VALUES(payload)' + . ', expires_at = VALUES(expires_at)' + . ', modified_at = VALUES(modified_at)', self::SPECIFICATION_SELECT => 'INSERT INTO %1$s %2$s %3$s', ]; } diff --git a/src/TableGateway/Feature/EventDispatcherFeature.php b/src/TableGateway/Feature/EventDispatcherFeature.php index 9a0a480..6e758d9 100644 --- a/src/TableGateway/Feature/EventDispatcherFeature.php +++ b/src/TableGateway/Feature/EventDispatcherFeature.php @@ -60,7 +60,7 @@ public function getEventDispatcher(): EventDispatcherInterface public function postDelete(StatementInterface $statement, ResultInterface $result): void { $this->dispatch( - name: static::EVENT_POST_DELETE, + name : static::EVENT_POST_DELETE, params: [ 'statement' => $statement, 'result' => $result, @@ -84,7 +84,7 @@ public function postInitialize(): void public function postInsert(StatementInterface $statement, ResultInterface $result): void { $this->dispatch( - name: static::EVENT_POST_INSERT, + name : static::EVENT_POST_INSERT, params: [ 'statement' => $statement, 'result' => $result, @@ -104,7 +104,7 @@ public function postSelect( ResultSetInterface $resultSet, ): void { $this->dispatch( - name: static::EVENT_POST_SELECT, + name : static::EVENT_POST_SELECT, params: [ 'statement' => $statement, 'result' => $result, @@ -121,7 +121,7 @@ public function postSelect( public function postUpdate(StatementInterface $statement, ResultInterface $result): void { $this->dispatch( - name: static::EVENT_POST_UPDATE, + name : static::EVENT_POST_UPDATE, params: [ 'statement' => $statement, 'result' => $result, @@ -136,7 +136,7 @@ public function postUpdate(StatementInterface $statement, ResultInterface $resul public function preDelete(Delete $delete): void { $this->dispatch( - name: static::EVENT_PRE_DELETE, + name : static::EVENT_PRE_DELETE, params: ['delete' => $delete], ); } @@ -156,7 +156,7 @@ public function preInitialize(): void public function preInsert(Insert $insert): void { $this->dispatch( - name: static::EVENT_PRE_INSERT, + name : static::EVENT_PRE_INSERT, params: ['insert' => $insert], ); } @@ -168,7 +168,7 @@ public function preInsert(Insert $insert): void public function preSelect(Select $select): void { $this->dispatch( - name: static::EVENT_PRE_SELECT, + name : static::EVENT_PRE_SELECT, params: ['select' => $select], ); } @@ -180,7 +180,7 @@ public function preSelect(Select $select): void public function preUpdate(Update $update): void { $this->dispatch( - name: static::EVENT_PRE_UPDATE, + name : static::EVENT_PRE_UPDATE, params: ['update' => $update], ); }