تماشای این درس نیاز به اشتراک حرفه‌ای دارد.

Create Laravel App0:00

We're going to start like every good series starts, and that's by running laravel new. We'll call our app serverless, and we're good to go. So we'll change into serverless, and open it in phpStorm. Okay, let's see if we can hit it from the browser. We'll try serverless.whip. There's our standard Laravel start screen, so we know everything is wired up and we're ready to get started. First thing we want to do is install the Sidecar package. I'm just going to pull this right out of the docs. It's just hammerstone/sidecar.

Install Sidecar Package0:35

I'm just going to pull this right out of the docs. It's just Hammerstone/Sidecar. We'll run this. Now we have the package. We're ready to go. Let's check the docs. There is an install command. We'll run the install command, php artisan sidecar:install, and all that does is publish a configuration file. Let's open that configuration file and see what's inside.

Review Sidecar Config0:55

file. Let's open that configuration file and see what's inside. The first thing you'll notice is at the top, there's an empty array. It has two commented out classes, just to kind of show you what goes here, but it's an empty array called functions, and that's where we're going to put all of our functions so that Sidecar will manage them. We have to make Sidecar aware of our function's existence so that it can pick it up and deploy it to AWS. There are several other options that we'll cover throughout the course of the series, but where I want to start right now is with the AWS credentials.

Configure AWS Credentials1:22

There are several other options that we'll cover throughout the course of the series, but where I want to start right now is with the AWS credentials. Because Sidecar is going to be publishing Lambda functions in your AWS account, Sidecar needs AWS credentials. You can set these up yourself and just provide the keys and the region and the bucket and the execution rule, and you can look into the code to see exactly what's required, but because setting up IAM credentials is kind of a nightmare, we have an interactive command. You can run php artisan sidecar configure, and that will walk you through exactly what you need to do to get Sidecar set up, so we're going to do that because that's definitely the easiest.

Create and Deploy Functions5:00

That's all that's required. Now you're fully set up. You can deploy Lambda functions, and your application can execute the Lambda functions. Let's move on to the fun stuff, actually creating and deploying some functions.

sidecar:configure

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟