bfg/embedded-call
bfg/embedded-call is a lightweight Laravel/PHP package for adding embedded call functionality to your app. It provides a simple, framework-friendly setup and clean integration, helping you implement call handling quickly without unnecessary boilerplate. Ideal for Laravel developers wanting a simple...
bfg/embedded-call is a tiny utility for invoking a "feature" while passing a transformed/adjusted payload into it. Given the 1-star / 0-dependent profile, treat the source as the primary documentation — read src/ before writing production code against it.
Minimal setup:
composer require bfg/embedded-call
Then publish any config the package ships:
php artisan vendor:publish --provider="Bfg\\EmbeddedCall\\EmbeddedCallServiceProvider"
Where to look first:
Your first use case: define a feature class that expects a data payload, then invoke it through the package with a mutation callback:
EmbeddedCall::feature(MyFeature::class)
->with($order)
->adjust(fn (array $data) => array_merge($data, ['currency' => 'EUR']))
->call();
If the concrete API differs (method names, argument order), follow the executor class rather than assuming the above.
Feature-as-a-class. The idiomatic shape is a dedicated class (or closure) that receives adjusted data and returns a result. Keep features small and single-purpose; the package is a thin dispatcher, not a framework, so responsibility for orchestration is yours.
Payload adjustment at the call site. The core value is deferring data shaping until invocation. Prefer adjusting at the boundary — a controller or job — rather than baking defaults into the feature itself. This keeps the feature reusable across contexts where adjustment differs.
Composition. Chain feature calls where one feature's output feeds another's input. Because data is adjusted per call, this is cleaner than mutating a shared array across features.
$quote = EmbeddedCall::feature(PriceQuote::class)->with($cart)->call();
$invoice = EmbeddedCall::feature(Invoice::class)
->with($quote)
->adjust(fn ($q) => ['amount' => $q['total'], 'tax' => $q['tax']])
->call();
Testing integration. Features that take adjusted data are straightforward to unit test in isolation; use EmbeddedCall in feature tests to assert the adjustment logic rather than the whole pipeline. Fake/spy the feature where the adjustment is the unit under test.
Container binding. If the package resolves features through the container, register feature interfaces in your AppServiceProvider so alternative implementations (e.g., a stub in tests) can be swapped.
composer.json and read the CHANGELOG/git history before upgrading.config/app.php aliases.composer.json in the package for Laravel/Illuminate version constraints before requiring in an existing app; small packages sometimes lag on major versions and cause resolver deadlocks.How can I help you explore Laravel packages today?