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

Package Builder Laravel Package

symplify/package-builder

Helper utilities for building Symfony/PHP packages: lightweight DI and service configuration, parameter resolution, class and file helpers, and tooling-friendly conventions. Designed to reduce boilerplate when composing reusable packages and developer tools.

Deep Wiki
Context7

Getting Started

Start by reviewing the archived README and source code—this package offers minimal setup but requires understanding its core utilities: ConfigBuilder, ParameterBuilder, and ServiceConfigurator. Install via Composer (composer require symplify/package-builder) only if maintaining legacy code. Your first practical use case is bootstrapping DI for multiple packages with shared configuration—e.g., a monorepo of Symfony console apps or Nette services where services.yaml duplication must be avoided.

Implementation Patterns

  • Programmatic config generation: Use ConfigBuilder to generate YAML config files (e.g., config/services.yaml) from PHP, eliminating manual YAML replication across packages.
  • Parameter validation & fallbacks: Leverage ParameterBuilder to define required parameters (e.g., project_dir, cache_dir) with sensible defaults and validation—fail fast on missing values.
  • Fluent service registration: Apply ServiceConfigurator to define services, tags, and method calls type-hinted and IDE-friendly (e.g., $services->load(App\ *, 'App\\')→tag('console.command')).
  • Monorepo command auto-wiring: Bundle commands via PackageConfigurator so new console commands auto-register in the app without manual service wiring.
  • DI composition root: Create a PackageConfigurator-implementing class per package to decouple config logic from the kernel/container—ideal for library authors publishing multiple symfony/console ornette packages.

Gotchas and Tips

  • Archived = unsupported: No PHP 8.3+, Symfony 7+, or Nette 4+ compatibility guaranteed—test thoroughly before use. Security vulnerabilities will not be patched.
  • Path assumptions: ConfigBuilder resolves config paths relative to __DIR__ inside your builder class; move config files accordingly or override getConfigPath().
  • Parameter collisions: ParameterBuilder throws on redefinition—always chain skipIfExists() before add() when integrating into larger DI setups.
  • Nette compiler pass ordering matters: If using ServiceConfigurator with Nette, you must order compiler passes manually (e.g., ->after(ContainerBuilder::class))—failure causes silent misconfiguration.
  • Debug effectively: Call dump($configBuilder->build()) or var_export($parameters) to verify generated config before writing to disk—no runtime logging occurs.
  • Extension point: Implement ConfigurablePackageInterface to inject custom bootstrapping (e.g., inject services from third-party bundles) without touching container internals.
  • Avoid in new projects: If not maintaining legacy code, replace with Symfony’s native ContainerBuilder, Laravel’s service container, or symfony/console + symfony/config directly.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport