Skip to content

feat(database): support creating database configs from a URL - #2315

Open
boydbloemsma wants to merge 2 commits into
tempestphp:3.xfrom
boydbloemsma:feat/database-config-from-url
Open

boydbloemsma wants to merge 2 commits into
tempestphp:3.xfrom
boydbloemsma:feat/database-config-from-url

Conversation

@boydbloemsma

Copy link
Copy Markdown
Contributor

Fixes #2310

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Benchmark Results

Comparison of feat/database-config-from-url against 3.x (b0ff1376b5dc34d0232f081f6ffda85a4186e50d).

Open to see the benchmark results
Benchmark Set Mem. Peak Time Variability
ViewRenderBench(benchPlainHtml) - 22.182mb 0.00% 560.493μs +5.74% ±2.20% -13.89%
ViewRenderBench(benchExpressions) - 24.772mb 0.00% 592.740μs +5.72% ±2.35% +51.13%
GenericRouteMatcherBench(benchMatch) Dynamic 4.683mb 0.00% 2.320μs +5.39% ±1.18% +15.05%
GenericRouteMatcherBench(benchMatch) Non existing short 4.683mb 0.00% 1.589μs +5.49% ±0.76% -20.06%
GenericRouteMatcherBench(benchMatch) Static route 4.683mb 0.00% 1.204μs +5.88% ±0.53% -33.41%
GenericRouterBench(benchDispatch) Static route 5.285mb 0.00% 22.900μs +5.81% ±0.48% +142.74%
GenericRouterBench(benchDispatch) Dynamic route 5.289mb 0.00% 27.985μs +7.24% ±0.79% -54.72%
GenericRouterBench(benchDispatchWithoutMiddleware) Static route 5.284mb 0.00% 19.051μs +7.35% ±0.58% -75.13%
GenericRouterBench(benchDispatchWithoutMiddleware) Dynamic route 5.288mb 0.00% 23.583μs +6.66% ±0.79% -59.73%
ContainerBench(benchAutowireNested) - 4.172mb 0.00% 8.235μs +5.37% ±0.70% -27.66%
ContainerBench(benchRegisterSingletonInstance) - 6.115mb 0.00% 1.539μs +5.71% ±0.64% -48.65%
ContainerBench(benchSingletonAttribute) - 4.141mb 0.00% 0.528μs +8.90% ±1.06% -4.39%
ContainerBench(benchResolveDefinition) - 4.093mb 0.00% 1.406μs +10.04% ±0.50% -35.85%
ContainerBench(benchResolveWithInitializer) - 4.135mb 0.00% 3.686μs +6.87% ±0.70% -17.62%
ContainerBench(benchRegisterInitializer) - 6.431mb 0.00% 3.512μs +5.63% ±0.61% -40.60%
ContainerBench(benchRegisterDynamicInitializer) - 6.255mb 0.00% 2.118μs +6.86% ±0.72% -63.82%
ContainerBench(benchInvokeClosure) - 4.146mb 0.00% 5.827μs +6.79% ±0.50% -23.86%
QueryExecutionBench(benchExecuteInsert) - 4.413mb +0.08% 4.733μs +7.04% ±1.11% -45.37%
QueryExecutionBench(benchFetchAll) - 4.413mb +0.08% 21.011μs +7.86% ±1.99% -17.81%
QueryExecutionBench(benchFetchWithBindings) - 4.413mb +0.08% 7.837μs +6.57% ±0.54% -68.13%
KernelBootBench(benchBoot) - 30.625mb +0.12% 78.909ms +8.80% ±3.09% +60.87%

Generated by phpbench against commit 7c9fd7e

@aidan-casey aidan-casey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @boydbloemsma! Thanks for taking this on, I appreciate your work on this.

First, I would recommend we rename this to DatabaseConnectionString, which is the term typically used for this string.

Second (and this is technically a limitation of the existing implementation as well), we need to allow for query parameters within the DSN such as connect_timeout, keepalives, sslmode, etc.

Third, I'd like to see a test case with a Unix socket in the DSN added to this.

Finally, I'd suggest we make this a true value object with methods such as getHost, etc. I'm not sure we should perform the actual validation on the scheme within the VO vs. the config itself.

@brendt

brendt commented Oct 23, 2026

Copy link
Copy Markdown
Member

Agree with Aidan's feedback expect for the getters. Don't add getters but use public readable properties

@boydbloemsma

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify connecting to database from connection string / url

3 participants