After over a decade since the introduction of the wildly popular Laravel framework, have you ever wondered, “What else can Laravel offer PHP developers?”
Given how much it has already simplified PHP development for both beginner and professional developers, some may even argue that it has spoiled developers into believing that PHP is the easiest programming language out there.
So, does Laravel still have more surprises in store for Laravel developers? Or has it exhausted all possible means to support PHP developers?
Well, at the very least, we know that Laravel 10 has a lot to offer. This is what we’ll uncover in this article as we take you on a journey through Laravel 10’s new features, fixes, and freshly deprecated methods and packages.
Laravel Release Schedule
The Laravel core team used to release two major versions annually (one every six months).
However, the release cycle was changed when Taylor Otwell, the creator of Laravel, announced that a single major version would now be released each year. This enabled the core team and community to devote more time and effort to a specific version of the framework and introduce new powerful features without making any breaking changes.
Laravel 10 was scheduled to be released on February 7, 2023, following the release of Laravel 9 on February 8, 2022. However, the team needed more time to finalize their piece of art, and Laravel 10 was eventually published on February 14, 2023.
Laravel 11 is now expected to be released in the first quarter of February 2024.
In addition, according to the support policy, bug fixes are offered for 18 months and security updates for two years for all Laravel versions.
The following are the expected bug fixes and security updates schedule:
- Laravel 9 will continue to get bug fixes until August 8, 2023 and security fixes until February 6, 2024.
- Laravel 10 will get bug fixes until August 6, 2024 and security fixes until February 4, 2025.
- Laravel 11 is expected to get bug fixes until August 5, 2025 and security fixes until February 3, 2026.
Should You Upgrade to Laravel 10?
It’s important to remember that we don’t always need to upgrade our application’s Laravel version to the latest version as soon as a new version gets released.
Laravel is an open-source framework, which implies that every time we install a new Laravel instance on our machine, we own the framework’s codebase. This means that even if the framework version our app is using is no longer supported, the app will still work; we’ll just have to maintain it ourselves.
As a result, it is widely suggested that application stability be prioritized over framework upgrades.
In short, you should consider upgrading to Laravel 10 when:
- The application is stable with its current version and functioning without problems.
- The new version either adds a feature that your application requires or fixes an issue that your application is experiencing.
- The application will be well tested before the upgrade changes are pushed into production.
Laravel 10 Hot Updates
Kinsta is a big fan of Laravel. That is why we have gathered the highlights of Laravel 10 into a single article for you to use as a reference and guide to use all of the new features. Therefore, we recommend bookmarking this page and revisiting it from time to time.
New Features and Updates in Laravel 10
There’s no doubt that the most exciting part about any new release is the addition of new features. So without further ado, let’s start by having a look at the new features and updates in Laravel 10.
1. PHP 8.1: At the Heart of Laravel 10
PHP 8.1 is the minimum-required PHP version in Laravel 10. Some PHP 8.1 features, such as readonly properties and array_is_list, are used in Laravel 10.
2. Support for PHP 8.2
PHP 8.2 was released on December 8, 2022, only two months before Laravel 10 release date. Yet, this shouldn’t stop you from utilizing PHP 8.2 features, as without doing anything extra, Laravel 10 is ready for PHP 8.2.
In fact, the entire Laravel ecosystem, including Forge, Vapor, and Envoyer, supports PHP 8.2, and you can even use PHP 8.2 with Laravel 9. How cool is that?!
3. Laravel Official Packages Upgrade
Not only is the framework professionally maintained and updated on a regular basis, but so are all of the official packages and the ecosystem.
The following is a list of the most recent official Laravel packages that have been updated to support Laravel 10:
Another treat for Rails, Vue, React, and Svelte fans, Inertiajs 1.0.1 is also supporting Laravel 10.
4. Predis Version Upgrade
Predis is a robust Redis client for PHP that may help you get the most out of caching to provide a fantastic user experience. Laravel formerly supported both versions 1 and 2, but as of Laravel 10, the framework no longer supports Predis 1.
Although Laravel documentation mentions Predis as the package for interacting with Redis, you may also use the official PHP extension. This extension provides an API for communicating with Redis servers.
5. Native Type Declarations
Laravel used to utilize DocBlocks in its skeleton code to clarify what a piece of code does and what sorts of parameters or responses to expect. However, thanks to native type declarations in Laravel 10, this will change.
The best way to explain this change is with a simple example. Instead of a function looking like this:
/**
* Determine whether the user can create models.
*
* @param {{ namespacedUserModel }} $user
* @return IlluminateAuthAccessResponse|bool
*/
public function create({{ user }} $user)
{
//
}
…it will look like this:
/**
* Determine whether the user can create models.
*/
public function create({{ user }} $user): bool
{
//
}
This change is purely for the benefit of the developer experience, as IDEs will know the shape of the expected parameter and response. It will provide better type clarity when not possible through PHP native types. Hence, it will help the code editors to perform better with auto-complete features.
6. All Validation Rules Invokable by Default
If you were to make an invokable validation rule in Laravel 9, you would need to add an --invokable
flag after the Artisan command. This is no longer necessary because all Laravel 10 rules are invokable by default. So, you may run the following command to create a new invokable rule in Laravel 10:
php artisan make:rule CustomRule
7. Native Column Modification Support
In an attempt to eliminate the need for the DBAL (doctrine/dbal
) package when using change()
to modify columns, a new feature was introduced in Laravel 10 that allows developers to use change()
method and modify columns with MySQL, PostgreSQL, and SQL Server without the need for extra packages. This is a significant and risky breaking change, but we believe it’s worthwhile since it will eliminate dependency on an additional package.
To gain a better understanding of the new feature, see the example below:
$table->integer('user_balance')->unsigned()->default(0)->comment('balance'); // `user_balance` is an integer, unsigned, defaults to '0', and column comment is 'balance'
Now, we’re assuming that we have a column for user_balance
and we want to change its type. Starting from Laravel 10, we can simply do this:
$table->bigInteger('user_balance')->change(); // This will change `user_balance` to bigInteger instead of just integer
The above code will successfully change the type of the column, but will also drop the UNSIGNED
, DEFAULT
, and COMMENT
attributes. Therefore, it’s important to remember to add all the attributes when you’re changing the type of a column:
$table->bigInteger('user_balance')->unsigned()->default(0)->comment('balance')->change();
In the case where you have multiple database connections and have already installed DBAL, it’s recommended to call the Schema::useNativeSchemaOperationsIfPossible()
method within the boot method in AppProvidersAppServiceProvider
to be able to use native schema operations and to use native operations before relying on the package (SQLite, for example, does not yet support this):
use IlluminateSupportFacadesSchema;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Schema::useNativeSchemaOperationsIfPossible();
}
}
8. Column Type Native Retrieval
Another noteworthy feature of Laravel 10 is the ability to use the Schema::getColumnType
method without having to rely on the doctrine/dbal
package. We currently use Schema::getColumnType
with DBAL to obtain the column type. DBAL maps every native column type to its DBAL type equivalent, and it does not support many of the column types used by Laravel across various databases.
In Laravel 10, on the other hand, the new Schema::getColumnType
method will return the actual column type rather than its DBAL equivalent. It also enables you to write integration tests for the new native column modifying feature. You may use this feature to get either the data type name or the whole type definition of the specified column:
Schema::getColumnType('products', 'price'); // decimal
9. Faster Hashing Algorithm
xxHash is a Hash algorithm that is incredibly fast. It features great output randomness and dispersion, as well as uniqueness to reduce collisions. Since PHP 8.1 provides support for xxh128, and because Laravel 10 runs on PHP 8.1, having such a reliable hash algorithm within Laravel 10 is ideal.
It’s worth mentioning that Taylor highlighted during his review of this change that some third-party packages may rely on the file names being in the exact format as the SHA-1 hash, which is the algorithm Laravel used to use for hashing. Therefore, If you’re planning an upgrade to Laravel 10, it would be wise to double-check this in any third-party packages you’re using in your app.
10. whereExists()
Method Support for Eloquent Builder
Currently, using whereExists()
requires configuring the nested query using a closure. Fortunately, with Laravel 10, it is now possible to include an Eloquent Builder as a nested query. It enables the usage of custom builder methods, model scopes, and so on.
For instance, we normally do this if we want to use whereExists()
:
Order::whereExists(function ($query) {
$query->from('products')->whereColumn('products.order_id', 'orders.id');
});
With Laravel 10, we can just do this instead:
Order::whereExists(
Product::whereColumn('products.order_id', 'orders.id')
);
11. Eager Loading Optimization
One of the interesting new features of Laravel 10 is eager loading optimization when there aren’t any keys to be loaded. This change is more of a fix than a feature since it tackles a current issue in which eager loading relations causes a large number of impossible queries to be executed.
Currently, when eager-loading relations that don’t have any keys to be loaded, Laravel will still execute a query similar to this one:
select * from `table_name` where 0 = 1
However, the new Laravel 10 update checks to verify whether there are any keys available in the first place and, if there aren’t any, provides an empty collection, eliminating the need for the unnecessary database queries.
12. $path
Optional for Filesystem Methods
In Laravel 10, the $path
parameter is optional for the below methods:
FilesystemAdapter#putFile
FilesystemAdapter#putFileAs
UploadedFile#store
UploadedFile#storeAs
UploadedFile#storePublicly
UploadedFile#storePubliclyAs
So instead of doing this in order to store an uploaded file on Amazon S3:
Storage::disk('s3')->putFile(‘post/images', $uploadedFile);
…we can do this:
Storage::disk(Disk::PostImages)->putFile($uploadedFile)
13. Database Expressions and Grammar-Specific Formatting
Just four days before the release of Laravel 10, the Laravel core team decided to merge a brilliant feature that addresses a big challenge when working with multiple databases.
In previous versions, if we were working with PostgreSQL and MySQL and wanted to return the first value of a list as an alias, we would have to write raw database code and do the following:
DB::table(‘visitors')
->when(isPostgreSQL(), fn ($query) => $query->select(DB::raw('coalesce(NULL, "user", "guest") AS "First Visitor"')))
->when(isMySQL(), fn ($query) => $query->select(DB::raw('coalesce(NULL, `user`, `guest`) AS `First Visitor`')))
In the above code, we’re using the COALESCE()
function to return the first non-null value as an alias named first visitor. So, every time we would need to perform an operation like this, we would have to write raw database code again.
The new feature enables us to create reusable expression classes that implement the raw expressions and statements we need for our queries only once. This will eliminate the necessity to write raw database code when we want to use more database functionalities.
Going back to the above example, let’s follow the new Laravel 10 approach to achieve the same outcome but without using raw database code syntax.
First, we would need to create two classes — one for aliasing, and one for using COALESCE()
function:
class Alias implements Expression
{
public function __construct(
public readonly Expression|string $expression,
public readonly string $name,
) { }
public function getValue(Grammar $grammar): string
{
return match ($grammar->isExpression($this->expression)) {
true => "{$grammar->getValue($this->expression)} as {$grammar->wrap($this->name)}",
false => $grammar->wrap("{$this->name} as {$this->name}"),
};
}
}
class Coalesce implements Expression
{
public function __construct(
public readonly array $expressions,
) { }
public function getValue(Grammar $grammar): string
{
$expressions = array_map(function ($expression) use($grammar): string {
return match ($grammar->isExpression($expression)) {
true => $grammar->getValue($expression),
false => $grammar->wrap($expression),
};
}, $this->expressions);
$expressions = implode(', ', $expressions);
return "coalesce({$expressions})";
}
}
Then, we can do this to achieve the desired outcome for both MySQL and PostgreSQL:
DB::table('visitors') ->select(new Alias(new Coalesce([NULL, 'user', 'guest']), 'First Visitor'));
You could think it’s too much work to write, but it’s definitely worth it because you’ll only have to write it once and it will spare you the hassle of changing syntax when dealing with multiple databases.
Furthermore, according to the pull request’s creator, Tobias Petry, this change will open the door for numerous possibilities for packages to provide the most common raw expression classes for you. He even stated that he will provide it for the community in a dedicated package after Laravel 10’s release.
14. SQL Server Update To Use FETCH
and OFFSET
for Queries That Do Not Include an orderBy
When we use orderBy
in a query like this one:
$builder->select('*')->from('users')->skip(11)->take(10)->orderBy('email', 'desc');
Laravel then produces SQL statement that uses FETCH
and OFFSET
:
select * from [users] order by [email] desc offset 11 rows fetch next 10 rows only
However, in previous versions of Laravel, if we drop orderBy
from the query, it falls back to the old method of offsetting the results:
$builder->select('*')->from('users')->skip(11)->take(10);
select * from (select *, row_number() over (order by (select 0)) as row_num from [users]) as temp_table where row_num between 11 and 20 order by row_num
But now in Laravel 10, this new update will enable your Laravel 10 application to use FETCH
and OFFSET
even when orderBy
is not present:
select * from [users] order by (SELECT 0) offset 10 rows fetch next 10 rows only
This update improves the speed by 33% and requires fewer execution steps.
15. PHPUnit 10 Support
Laravel 10 supports PHPUnit 10. It is a framework for unit testing for PHP and version 10 was released on February 3, 2023. Laravel 10 will still have support for PHPUnit 9 and 8.
16. Security Improvements for Timebox
Class
Laravel 10 includes security improvements for the Timebox
class, which aims to guard the application against timeless timing attacks. The Timebox
Class is implemented inside the hasValidCredentials
method.
The Timebox
class now has support to handle exceptions thrown during a Timebox’s callback execution.
17. dispatch()
Method Behavior is The Same Across Laravel 10
The dispatch()
method inside the DispatchesJobs
trait is now checking for unique jobs the same as the global dispatch()
helper function. This makes dispatch()
methods adopt the same functionalities across Laravel 10.
18. Laravel Pennant
If you’ve ever worked on a web application that is constantly being updated with new features, you understand how vital feature flags are. Nevertheless, preserving feature flags would need a significant amount of work to do it right, but worry not, Laravel has you covered with the new first-party Laravel Pennant package.
Laravel Pennant provides an easy-to-use solution for maintaining feature flags. It even comes with an in-memory array driver and a database.
You can easily define a new feature:
use LaravelPennantFeature;
use IlluminateSupportLottery;
Feature::define('new-color-button', function () {
return Lottery::odds(1, 10);
});
Then you’ll be able to check whether the user has access to this feature or not:
use LaravelPennantFeature;
if (Feature::active('new-color-button')) {
// ...
}
It even looks prettier in Laravel Blade:
@feature('new-color-button')
// Kinsta Rules!!
@endfeature
19. Laravel Process Interaction
The new Process Interactions in Laravel 10 makes testing and running CLI processes a piece of cake. It offers a straightforward API to ease the burden of testing. Let’s grab the example from the original PR for the feature by Taylor:
use IlluminateSupportFacadesProcess;
$result = Process::run('ls -la');
$result->successful();
$result->failed();
$result->exitCode();
$result->output();
$result->errorOutput();
$result->throw();
$result->throwIf(condition);
You’ve probably noticed how simple and clean the above code is. Moving on to building processes, things only get better:
$result = Process::timeout(60)->path(base_path())->env([...])->run('ls -la');
$result = Process::forever()->run('ls -la');
Now, to use this new feature in testing, you may create a new and fake process like this:
Process::fake([
'ls *' => Process::result('Hello From Kinsta'),
]);
Then you may run the fake process and use the newly available assertions:
$result = Process::run('ls -la');
Process::assertRan(function ($process, $result) {
return $process->command == 'ls -la';
});
Process::assertRanTimes(function ($process, $result) {
return $process->command == 'ls -la';
}, times: 1);
Process::assertNotRan(function ($process, $result) {
return $process->command == 'cat foo';
});
20. Pest Scaffolding
Pest test scaffolding is now enabled by default when creating new Laravel projects. To enable this feature, use the --pest
flag when building a new app with the Laravel installer:
laravel new example-kinsta-app --pest
21. String Password Helper Function
Laravel 10 can create a random and secure password with a given length:
$password = Str::password(12);
Deprecated Methods and Packages in Laravel 10
Next, we’ll look at the packages and methods that were expunged with the release of Laravel 10.
Laravel 10 Says Goodbye to PHP 8.0
Laravel framework drops support for PHP 8.0 in Laravel 10. Hence, If you’re planning to upgrade your app to Laravel 10, you must first update the PHP version to PHP 8.1 or PHP 8.2.
Deprecated Methods Removal
Laravel documentation is updated with all changes and important deprecations. If you’re going to migrate a current project to Laravel 10, any code that uses a deprecated method should be rewritten in a new approach to achieve the same result.
Here’s a list of some of the deprecations:
- The
Route::home
method (deprecated in Laravel 9) - Functions and methods around
dispatchNow
, deprecated to encourage developers to usedispatchSync
, the only supported method for immediate dispatch - The
getBaseQuery
method, which has atoBase
equivalent - The
MaintenanceModeException
class - The
MocksApplicationServices
trait - The mail fake’s
Mail::failures
method - The
$dates
property (use$casts
instead) - The
assertTimesSent()
method - Support for Predis 1 and DBAL 2
- All related deprecations in
doctrine/dbal
since Laravel dropped support for version 2
How To Install Laravel 10
The Laravel core team made sure that all developers could easily access the framework on different environments. Therefore, there are various ways to get started with Laravel 10 on your machine, and you are entirely free to select whatever works best for you.
Install Laravel 10 on MacOS
You can easily get started with Laravel 10 on MacOS by using Docker and Laravel Sail. You may run the following terminal command from the directory where you want the application to be installed, keeping in mind that only alpha-numeric characters, dashes, and underscores are permitted for the app name:
curl -s "https://laravel.build/example-kinsta-app" | bash
After the installation process is completed, head to the project directory and use Sail to run your new project by hitting the following command in the terminal:
./vendor/bin/sail up
Sail will use its built-in solution for running your Laravel project using Docker, and once finished, your application will be ready on http://localhost
.
Install Laravel 10 on Windows 10 and 11
Docker Desktop may be used to quickly install Laravel 10 on Windows. However, whether you’re using Windows 10 or 11, you must first enable one of the following two options on your machine:
- Windows Subsystem for Linux 2 (WSL2) is a Windows operating system feature that allows you to run a Linux file system and Linux command-line tools directly on Windows.
- Hyper-V Backend Feature allows you to create and operate a software version of a computer known as a virtual machine.
As soon as you have fulfilled all Docker requirements, you may run the following command in your terminal:
curl -s https://laravel.build/example-kinsta-app | bash
Then use Sail to run your application on http://localhost
by hitting the following command from the root directory of your newly installed Laravel 10 project:
./vendor/bin/sail up
On a side note, many developers prefer Linux OS over other operating systems since it enables them to work more efficiently and quickly. With WSL, you can enjoy Ubuntu‘s security, performance, and gaming compatibility. Ubuntu is a Linux distribution or version of Linux that is well-known for its user-friendliness and ease of use.
It is encouraged that you use Visual Studio Code and install the official Microsoft WSL extension to be able to open any folder in the Windows Subsystem for Linux, and take advantage of vscode’s entire feature set. Additionally, Remote Development extension is another option that is referenced in the Laravel documentation.
Install Laravel 10 With Composer
Whether you use macOS or Windows, Composer can get you up and running with Laravel 10 in no time.
You would first need to ensure you have PHP ≤ 8.1, node, npm, and Composer installed on your machine.
- For macOS: Composer can be installed using Homebrew.
- For Windows: The latest stable version of Composer can be downloaded from the official Composer website.
Once you do, you can install Laravel Installer globally and use it to install your new Laravel 10 application:
composer global require laravel/installer
laravel new example-kinsta-app
Or, you can create a new Laravel 10 app directly using only Composer:
composer create-project laravel/laravel example-kinsta-app
How To Install Laravel 11
We’re still a year away from the release of Laravel 11. However, Laravel 11 is presently available for you to test its features. Not only is it available, but it also includes some merged PRs on GitHub, such as dropping PHP 8.1 support.
The --dev
flag in Laravel Installer installs the master branch from the laravel/laravel
repository, and now that Laravel 10 is out, Laravel 11 will be available on the master branch. If you’re using Laravel Installer, all you’ll have to do is run this command in your terminal:
laravel new example-kinsta-app --dev
Or, if you prefer using Composer:
composer create-project --prefer-dist laravel/laravel example-kinsta-app dev-master
To better understand the Composer command, here’s a quick explanation:
laravel/laravel
: The package for the Laravel installationexample-kinsta-app
: The new directory for your new project (can be changed)dev-master
: The next version of Laravel (in this case, Laravel 11)
After installing Laravel 11, you can confirm the version by navigating to the new example-kinsta-app directory and running this Artisan command:
$ php artisan --version
Laravel Framework 11.x-dev
How To Upgrade a Project to Laravel 10
Are you tempted to upgrade to Laravel 10? The Laravel core team works hard on documentation to provide a seamless and straightforward upgrade guide while covering every possible breaking change. Feel free to check the official Laravel 10 upgrade guide.
You should also keep an eye on Laravel Shift now that Laravel 10 has been released. Laravel Shift offers a simple and automated approach to upgrading your Laravel version.
How To Deploy Laravel 10 Projects
Deploying Laravel 10 isn’t any different from deploying Laravel 9 project.
Here are the server requirements:
- PHP ≤ 8.1
- Ctype PHP Extension
- cURL PHP Extension
- DOM PHP Extension
- Fileinfo PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PCRE PHP Extension
- PDO PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
- Filter PHP Extension
- Hash PHP Extension
- Session PHP Extension
You may deploy and host your Laravel 10 project on Kinsta in a matter of minutes since Laravel is one of a long list of supported frameworks for hosted apps.
Deploying Laravel 10 on Kinsta: Step-by-Step Guide
There are several benefits to hosting and deploying your Laravel applications on Kinsta, including not having to bother with the deployment configuration.
Kinsta provides a user-friendly yet powerful tool for deploying applications, connecting to databases, and monitoring live performance. This tool is known as MyKinsta, and in this section, we will walk you through the steps to deploy a Laravel 10 application using it.
1. Prepare Your Application
Assuming that you have a Laravel 10 application locally, we need to make sure that it has a GitHub repository available. We will use this repository to deploy the application later.
You may include an .htaccess file in the root directory of your application that contains the following:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
For Laravel, this redirects all requests to public/index.php. However, if needed, you may update this command while adding your application (Set up your processes step) or after deployment, on the application’s Processes page. You can use:
heroku-php-apache2 /public
php artisan serve --host 0.0.0.0 --port 8080
2. Log In to MyKinsta
Head to the MyKinsta login page and enter your email address and password. If you don’t yet have an account, you can register a new account and get $20 off your first month of any pricing plan subscription.
3. Authorize Kinsta on GitHub
Once you login, you will notice that the dashboard has options to create a WordPress site, create an application, or create a database. We will press on the Connect GitHub button to integrate with GitHub.
Next, click on the Continue with GitHub button. If you aren’t already logged in to GitHub, you’ll be shown the option to log in. Then you may authorize the Kinsta GitHub application to access your GitHub account by selecting Authorize Kinsta.
Finally, GitHub will redirect your browser to MyKinsta in order to continue setting up the application.
After you’re connected to GitHub, you will be shown the Add Application popup/modal, which has a dropdown menu to select a GitHub repository. Click the GitHub repository field and select Edit GitHub permissions in the dropdown.
This will open a new tab in your browser to the GitHub webpage, where you can choose which data Kinsta will be able to access. Instead of enabling access to all repositories, consider choosing only the one(s) you want Kinsta to use.
Click Only select repositories and choose the repository you would like to deploy.
Then click Install, and you’re all set!
When you return to MyKinsta and click the GitHub repository field, the authorized repository should be visible. Additionally, you may tick the Automatic deployment on commit checkbox to enable MyKinsta to auto-deploy your application as soon as you make any changes to the GitHub repository.
4. Add Application Basic Details
You can now give the application a name that will only be used in the dashboard and select from 25 data center locations, allowing you to place your application in the geographical location nearest to your users. If you need assistance determining which data center is ideal for your application, check out our guide to choosing the right data center location.
5. Add Environment Variables
The following section is for adding environment variables and the most important variable is the APP_KEY
.
If you don’t have a key in your .env file already, you can generate one using an online Laravel key generator. Then, insert APP_KEY
in the Key 1 field and insert the generated app key in the Value 1 field.
Finally, select Available during runtime and Available during build process.
6. Configure Build Environment
The magical thing here is that you don’t have to configure anything! You may proceed by clicking the Continue button, and voilà: You have completed the built environment configuration. However, if you want to enhance the build resources to ensure faster building, you may pick your preferred choice from the Build resources field.
The Build path field is optional. You may leave it empty, and MyKinsta will use the root folder.
7. Set up Processes and Payment Method
For the Resources section, fill in each field with the following information:
- Process name: The name displayed in the list of your application’s processes.
- Process type: Choose carefully, because this cannot be changed once it’s set. You can, however, add and change additional processes, like a background job, on your application’s Processes page after deployment.
- Start command: The “Start” command for your process (not required).
- Pod size: The pod capacity you expect you’ll need for your process.
- Instance count: The number of instances for your process (max 50).
Note that you can simply click Continue without filling the Start command field, as Kinsta automatically detects the required command during the first deployment.
For the last step, review the monthly usage costs calculated for your app, then confirm your payment method. When finished, click the Confirm payment method button.
And you’re done! Kinsta will do all the work in the background to serve your application.
Then you’ll have access to all of the deployment process details, as well as the temporary live app URL, which you can later replace with your own domain.
Your Laravel 10 application is now live on Kinsta, but what if you need to make a change in production? What if we want to change an anchor tag’s href
attribute?
Since we have activated the Automatic deployment on commit option, MyKinsta will detect any changes we make to the deployed branch and automatically update the live app accordingly.
8. Connect Laravel 10 to MySQL Database
Now that we’ve deployed our Laravel 10 application, we can effortlessly construct a database and link it to our application. All you have to do is click Applications from the navigation menu on the left, then Add service and select Database.
After filling in all the fields, click Create database. This will establish a new database ready for internal and external connections. In our scenario, we require an internal connection to the Laravel 10 project that we deployed.
To achieve that, all you need to do is to click on Add application in the Internal connections section and select your application. You can check the Add environment variables to the application checkbox and MyKinsta will fill in all the .env
variables your application needs.
With that, your Laravel 10 application is deployed and connected to a database.
How To Contribute to Laravel 10
Although Laravel is maintained by a core team, it’s actively developed by over 3,000 volunteer contributors.
Do you want to be one of those contributors and help shape Laravel’s future? If you answered yes, you could help developers all over the world by adding a new feature, fixing a bug, or even rewriting a confusing part of the documentation.
To contribute to Laravel 10, here’s what you need to do:
- Head to Laravel’s GitHub repository and check out the pull requests tagged with [10.x] in the title. This will provide you a clear picture of all the pull requests for Laravel 10. If one of the PRs addresses the contribution you intended to make, see if you can improve on it.
- If your planned contribution has not yet been addressed by someone else, then you may create a PR yourself.
- Not everything is worth adding to the framework codebase. Therefore, strive to only implement improvements that will be easy to maintain in the future and will help the vast majority of the Laravel community.
- Ensure adhering to Laravel’s contribution guidelines for a better chance of getting your changes merged with the framework.
Another reason to love Laravel 10 is that it allows you to win money for your contributions with bug hunts! We’ll look at those next.
Laravel 10 Bug Hunt Contest
Laravel 10 has announced an excellent contest in which a random contributor has the chance to win $1,000. This was the first contest of its kind in Laravel history. It was designed to encourage the community to find and patch hidden bugs in Laravel 10.
The rules were straightforward:
- Only PRs submitted to the
laravel/framework
repository’s 10.x branch are eligible. - Only “genuine” bug fixes were considered. New features, refactoring, and typo fixes were not considered.
- Every bug fix must be supported by a test.
- Accepted bug fixes were labeled on GitHub, and a random winner will be announced after the contest’s conclusion.
The contest was over when the first stable version of Laravel 10 was released on February 14, 2023.
Summary
So far, Laravel 10 appears to be extremely promising, and we’re excited to cover all the gifts it brings to the PHP world.
If you’re looking for more ways improve the performance of your Laravel app, you might consider switching to a premium hosting provider. Kinsta’s Application Hosting solutions are among the fastest, most secure, and easiest to use in the industry, and they’re specifically designed with developers in mind, offering production streamlining and 24/7 expert support from our own seasoned developers.
Leave a Reply