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

Instantiator Laravel Package

doctrine/instantiator

Lightweight PHP library to instantiate objects without calling their constructors. Useful for hydrators, serializers, proxies, and testing/mocking. Part of the Doctrine ecosystem; creates instances via reflection while avoiding side effects and required constructor args.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit: The package fits as a niche utility for specific testing and ORM scenarios within Laravel. While Laravel's Eloquent ORM doesn't natively require it, it becomes valuable when working with Doctrine ORM integrations (e.g., laravel-doctrine), or when testing classes with complex constructor dependencies (e.g., private constructors, final classes). It complements Laravel's testing tools but isn't core to standard Eloquent workflows.
Integration feasibility: High. Composer-based installation is trivial, and Laravel's dependency management handles it seamlessly. Minimal code changes needed—only required in specific test or serialization contexts.
Technical risk: Low. Widely adopted (11k+ stars) with stable maintenance. However, misuse in production code (e.g., bypassing constructors for non-testing purposes) could introduce hidden state issues.
Key questions:

  • Does Laravel's built-in testing tools (e.g., Mockery, PHPUnit mocks) already cover these use cases without extra dependencies?
  • Are there Laravel-specific patterns (e.g., newInstanceWithoutConstructor()) that replicate this functionality?
  • How critical is constructor bypassing for current project needs versus hypothetical edge cases?

Integration Approach

Stack fit: Primarily a dev dependency for testing and Doctrine ORM-related workflows. Fits cleanly in Laravel's ecosystem as a lightweight, isolated tool for edge-case object instantiation—ideal for testing legacy code or third-party libraries with restrictive constructors. Not relevant for standard Eloquent model hydration.
Migration path:

  1. Add to composer.json as dev dependency: composer require --dev doctrine/instantiator.
  2. Use in test suites where constructor bypass is unavoidable (e.g., mocking classes with private __construct()).
  3. Replace manual reflection-based instantiation with `Instant
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony