Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Zend Auradi Config Laravel Package

zendframework/zend-auradi-config

Zend Auradi Config integrates Auradi-style configuration loading into Zend Framework apps. Provides utilities to read, merge, and manage environment-specific config sources for cleaner, modular application configuration.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the package via Composer: composer require zendframework/zend-auradi-config. Then, create a Zend-style config array (e.g., config.global.php) with service definitions and parameters—structured like:

return [
    'dependencies' => [
        'invokables' => [
            SomeInterface::class => SomeService::class,
        ],
        'factories' => [
            AnotherService::class => AnotherServiceFactory::class,
        ],
    ],
    'parameters' => [
        'database.dsn' => 'mysql:host=localhost;dbname=test',
        'debug' => false,
    ],
];

Use Zend\AuraDi\Config\ConfigResource to load and merge config files into an Aura\Di\ContainerBuilder:

$builder = new Aura\Di\ContainerBuilder();
$builder->addConfig(new Zend\AuraDi\Config\ConfigResource($configArray));
$container = $builder->newInstance();

First use case: bootstrapping a small app with environment-specific config overrides (e.g., config.local.php) without writing DI code manually.

Implementation Patterns

  • Layered Configuration: Load base config (config.global.php) first, then merge environment-specific files (e.g., config.local.php, config.development.php) using ArrayObject or custom merging logic. ConfigResource handles Zend-style dependencies and parameters keys directly.
  • Declarative Service Wiring: Define services via invokables, factories, methods, and objects under dependencies, mirroring Zend Framework conventions—ideal for teams already familiar with Zend skeleton apps.
  • Parameter Injection: Bind scalar/config values via the parameters key, then inject them into services using @param $parameterName in factory signatures or constructor injection via get() in factory classes.
  • Modular Architecture: Distribute config across modules/packages, each returning a config array with dependencies and parameters. Aggregate them before passing to ConfigResource for modular, scalable DI setup.

Gotchas and Tips

  • Dead Package: Since the repo is archived (last release 2019) and unmaintained, vet compatibility with modern PHP/Aura.Di versions—prefer laminas/laminas-auradi-config if migrating to Laminas (same API, newer support).
  • Config Key Sensitivity: Zend-style config expects dependencies and parameters keys; typos or incorrect nesting (e.g., services instead of dependencies) silently fail or throw during container instantiation.
  • Factory Naming Conflicts: If using factories that rely on autowiring, ensure factory class names match Aura.Di’s expectations—ConfigResource does not auto-detect factory interfaces or resolve ambiguous signatures.
  • Merge Order Matters: When merging multiple config files, later configs override earlier ones at key level only—non-recursive arrays (e.g., parameters) overwrite entirely. Use recursive merge helpers if needed.
  • Debug Tip: Enable ContainerBuilder::$debug = true to see generated service definitions and catch invalid factory/resolver references early.
  • Extensibility: Extend ConfigResource to add custom config keys (e.g., di_extensions) by overriding __invoke() and passing extra config to $builder->addConfig().
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope