State of Laravel and Laravel Vapor
Taylor Otwell

Slides: https://www.pscp.tv/w/1nAKEzLPpNgGL

(Slides link goes to Freek's live-stream of Taylor's talk)

(Also, Matt Stauffer is blogging about it here)

(While Taylor sets up...planking competition between audience members and Steve Schoger. Everyone wins!)

Welcome to Laracon US 2019!

After-Party, drinks are on Taylor for an hour after the talk wraps up!

State of Laravel

Next release due at the end of August.

As we know, we've been on 5.X release cycle since 2014. Here are some things that didn't exist...and it's a list of packages and such, lol. Countless community packages. Staff members! Hired Mohamed Said, Dries Vints to help, and James Brooks starts next week! Going to be looking into Laravel Nova to start with

NEXT RELEASE IS LARAVEL 6.0 IN AUGUST 2019!

Will 6.0 be a paradigm shift? No. Main difference will be the change to the new versioning scheme

Packages are already semver'd

Used to be paradigm.major.minor (paradigm change like for folder/architecture system), but the architecture has been pretty darn good, so 6.0 is more of a stamp of approval for moving into the future with that. Makes it easier to grok for newcomers

Now that Laravel's more mature, more of a budget

New fresh look for Laravel, going to be working with Focus Lab for the design. Fresh logo treatment, fresh design

(todo: insert pictures)

Subtle animations on new site, new logo, new documentation with good typography, searchable through Algolia

The T-Shirts this year are the new Laravel 6 design, not Laracon!

First PHP framework to embrace queues, broadcasting, oauth2 server, notifications system, etc.

Tries to be forward-thinking

Getting application into production

Currently, there's Laravel Forge. Connect to AWS/Linode/DigitalOcean, sets up a new VM

Forge has painless VPS management, perfect for small/medium projects, basic load balancing, full server access.

For years, folks ask about auto-scaling, ready for major traffic, fully-managed (since Forge, you still need to manage OS updates, for example)

Used to demo Laravel Cloud. Whole front-end built, back-end built, but tabled. Didn't feel right.

For the last nine months, been working on Vapor application. Performance overview!

Laravel Vapor

Serverless deployment platform for Laravel, powered by AWS. Scalable, on-demand auto-scaling with zero server maintenance. Includes database, caches, assets, metrics, DNS and certs.

What IS serverless?

New tech driven by cloud providers. Idea is to deploy to server, don't worry about infrastructure. You, the developer, never have to worry about deploying. Elastically scales to meet demand. You no longer have to guesstimate the number of Horizon queue workers, for example

Team to organize projects, each team gets unlimited servers/members/etc

Team members get granular permissions

Vapor is served...through...Vapor!

Projects

Multiple environments, each gets its own vanity URL. Typically in a serverless environment, single environment. But with Vapor, you get multiple environments. Also, noindex gets added into response so they don't get picked up by search engines

$ vapor deploy production

Going to build, upload to CDN...all with zero downtime!

Vapor configured in vapor.yaml file, does a lot behind the scenes. Assets get uploaded, seamless.

Rollbacks?

Sure, click on the old deployment, then a "Rollback To" button.

php artisan up/php artisan down? Built into Vapor UI (Enable Maintenance Mode)

Custom domain, maintenance mode doesn't disable access to vanity.

Environment variables?

You don't have to manage as much, just application-specific ones. You can do a redeploy

Secrets

On AWS, limited to 4KB of environment variables. Secrets don't have a size limit. Will use the secret value as it existed when the deployment was first done (in case of a rollback)

Commands

Can run commands from the UI. In errors, you still see output and log

Metrics

Environment metrics (How many HTTP requests? How many queue invocations? Average duration? How much has it cost so far?

Logs

Can see logs separately between HTTP request and CLI/Queue. It's a websocket, so no need to refresh to see new entries

Databases

No databases attached, so let's see what databases can do. Can provision a fixed-size and server specs and disk size, public or private.

How do I attach a database? vapor.yaml. database: laracon-db No need to do any other configuration!

Hitting database route. Database metrics! See max connections, average connections, average CPU connections, free disk space. Can set up alarms

Database scaling

You can scale the database up

Backing up and restoring database?

You can restore to any point in time in the last three days, down to the second. Creates a new database that replicates that database. Easy to set up, no need to set up separate database backups!

# Getting into the database shell
$ vapor database:shell laracon-db

Network key, get SSH key, can access database from local machine's database client

Caches

Can create redis cache clusters (attached via vapor.yaml). Laravel has a dynamodb cache baked in, so you don't have to do any configuration yourself. Works well with the scheduler, like to prevent jobs from overlapping.

Can scale up the redis cache. Scale, bump up the number of nodes

Cache metrics include CPU utilization, hit rate, hits and misses, and average CPU utilization per node

Complicated to manage it on your own, but with Vapor, makes it as seamless as possible.

Can open cache tunnel to that and can connect to the cache locally

Queues

You don't have to configure anything; works out of the box by hooking into SQS and regular queue worker stuff

Domains

Can buy from within Vapor (though AWS) or hook in your own provider. Can also point nameservers and DNS records and SSL certificates

Mail

DKIM handled and all that jazz. Mail sent through SES (or inject your own). No configuration needed

File Uploads

When thinking about traditional applications, have to interact with files...but with serverless...eh. Limitations on file size. Recommended to just send file to S3/other storage. How to securely do that? S3 has pre-signed URLs that allows us to upload a file, the URL expires after a short period of time

Example is a name + avatar. Javascript package available on NPM to store a file. Vapor.store calls, gets a pre-signed URL, upload it and give us a progress percentage, here's where it is in the back-end.

What if someone uploads the file on S3 and abandons the action? In Vapor, uploads to a temporary directory, gets cleared out automatically after 24 hours

Other things

Can also add deployment steps like migrating the database

When deploying, deploy steps run on the server

Can also deploy from a CI/CD pipeline (e.g. require-dev includes laravel/vapor-cli). php vendor/bin/vapor deploy production, works like a champ

Can do vapor test, run PHPUnit against the exact PHP stuff that you'd be doing in the server

CLI

Can also see metrics, can configure everything from the CLI

Shipping in a few weeks, marketing page will be out shortly. Pricing $39/m or $399/y