How are you do access your application container from a custom Lambda handler? #1191
robmellett
started this conversation in
General
Replies: 2 comments 3 replies
-
You can see an example here: https://github.com/brefphp/laravel-bridge/blob/master/worker.php @deleugpn this might be something we may want to facilitate in the Laravel bridge, just like parts of brefphp/symfony-bridge#45 ? |
Beta Was this translation helpful? Give feedback.
1 reply
-
I ended up stealing an example from @Nyholm's Laravel php runtime example. This is what I settled on in the end. <?php declare(strict_types=1);
use Bref\Context\Context;
use Illuminate\Contracts\Console\Kernel;
require_once __DIR__.'/vendor/autoload.php';
return function ($event, Context $context) {
static $app;
if (null === $app) {
$app = require __DIR__.'/bootstrap/app.php';
}
return $app->make(Kernel::class)->call('generate:gif', [
'payload' => $event
]);
}; Thanks for the help guys! Would you like me to submit a PR to the docs, in case anyone else would need something like this @mnapoli ? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey guys!
I was just playing around with the lambda event handlers.
https://bref.sh/docs/function/handlers.html
I was wondering how you access your application container from the custom handlers though?
When uploading a file to S3, I'd like to trigger a specific artisan command but I'm a little stuck getting the artisan command to run with the s3 event payload.
I feel like I might be missing a step somewhere. Any suggestions would be much appreciated!
With a handler like this.
Beta Was this translation helpful? Give feedback.
All reactions