PHP 8.1 was released yesterday and includes many new features and improvements, including Enums, new
in initializers, readonly
properties, and much more.
You can find out more about the most exciting features in our YouTube video.
Now, as you may have noticed in the past few weeks, we ensured that Laravel, first-party libraries, Forge, Envoyer, Nova, and Vapor can support PHP 8.1 on day one. So, let's take a look at what you need to do in order to start using PHP 8.1.
Laravel
If you plan to use PHP 8.1 on Laravel, ensure you're at the latest version of Laravel. In addition, make sure you're on the latest version of any first-party package from Laravel such as Passport, Cashier, Dusk, etc.
Forge
If you use Forge to provision and deploy your application, you may now choose PHP 8.1 when creating a new server.
And, of course, you may install PHP 8.1 on your existing servers via the "PHP Versions" tab on the server's management dashboard.
Envoyer
Next, if you use Envoyer for your application's deployments, you may now select PHP 8.1 from your server's settings.
Vapor
If you are running a serverless Laravel application using Vapor, simply specify php-8.1:al2
as your preferred runtime in your application's vapor.yml
configuration file:
If you are using Docker-based deployments, you may use our laravelphp/vapor:php81
docker image. However, this image is still using PHP 8.1 RC6, as Alpine images do not use PHP 8.1's stable version at the time of this writing.
Once you deploy, your environment will automatically start using PHP 8.1 with zero downtime.
At Laravel, we're committed to providing you with the most robust, modern, and developer-friendly PHP experience in the world. We hope you are as excited about PHP 8.1 as we are.