Skip to content

Commit 97ffe99

Browse files
committed
chore: upgrade utopia-php/servers to 0.3.* and utopia-php/di to 0.3.*
- Replace all Dependency class usage with new Container::set(string, callable) API - Add executeHook() method to Http class to replace removed Container::inject() - Update Route to call parent::__construct() for Hook's new constructor - Update all test files and examples to use new DI API - Resolves breaking changes from DI dropping Dependency/Injection classes https://claude.ai/code/session_0196tmVsX1KjJKmuHncp7HiV
1 parent b704e80 commit 97ffe99

11 files changed

Lines changed: 186 additions & 343 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"require": {
3131
"php": ">=8.1",
3232
"ext-swoole": "*",
33-
"utopia-php/servers": "0.2.*",
33+
"utopia-php/servers": "0.3.*",
3434
"utopia-php/validators": "0.2.*",
3535
"utopia-php/compression": "0.1.*",
3636
"utopia-php/telemetry": "0.2.*"

composer.lock

Lines changed: 25 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/src/server.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require_once __DIR__.'/../vendor/autoload.php';
44

55
use Utopia\DI\Container;
6-
use Utopia\DI\Dependency;
76
use Utopia\Http\Http;
87
use Utopia\Http\Response;
98
use Utopia\Http\Adapter\Swoole\Server;
@@ -18,9 +17,7 @@ public function __construct(public $name)
1817

1918
$container = new Container();
2019

21-
$user = new Dependency();
22-
$user->setName('user')->setCallback(fn () => new User("Demo user"));
23-
$container->set($user);
20+
$container->set('user', fn () => new User("Demo user"));
2421

2522
Http::get('/')
2623
->param('name', 'World', new Text(256), 'Name to greet. Optional, max length 256.', true)

0 commit comments

Comments
 (0)