How can i Update my laravel to latest version(8 or above)
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
In the ever-evolving world of web development, keeping your Laravel application up-to-date with the latest features and security patches is crucial. This guide will walk you through the process of updating your current Laravel project from version 4.2 to 8 or above while ensuring a smooth transition.
Prerequisites
- A Laravel installation with any version (in this example, we're starting with 4.2)
- Composer (version 1.7 or higher) installed globally and working locally.
- PHP 7.3 or higher installed on your system
Before proceeding, ensure you have a backup of your Laravel project to avoid any data loss in case of an error during the update process.
Updating Laravel Version
- Install the latest version of Laravel Composer installer by running the following command globally:
- Update your composer.json to include the required dependencies and configure to use a specific Laravel version (e.g., for Laravel 8):
- Use the Laravel installer to update your project:
- Run the following commands to update composer and Laravel dependencies:
- Verify your project has been updated successfully by running a simple command:
- Ensure all dependencies are up-to-date and compatible with Laravel 8.
composer global require laravel/installer
{
"require": {
"laravel/framework": "^8.0"
},
"config": {
"optimize-autoloader": true,
"prefer-stable": true
}
}
laravel new my_app --force
cd my_app
cp -r app/ public/ config/ routes/ database/ migrations/ seeds/ resources/ views/ vendor/ storage/ webpack.mix.js .
composer install
php artisan migrate:fresh --seed
composer update
composer require laravel/Framework:^8.0
php artisan --version
Updating PHP Version
If your current PHP version is lower than required for Laravel 8, follow these steps:- Download the latest stable PHP version from https://www.php.net/downloads and install it on your system.
- Configure your web server to use the new PHP version (e.g., for Apache: set the PHP_FCGI module to load the correct Dynamic Shared Object file, and update your VirtualHost configuration).
- Restart your web server.
- Update your Laravel project's .env file to use the new PHP version:
APP_ENV=production
APP_DEBUG=false
APP_URL=http://localhost
PHP_VERSION=7.3
php artisan migrate:fresh --seed
composer update
Congratulations! You have successfully upgraded your Laravel application from version 4.2 to the latest stable release, ensuring you're equipped with the most recent features and security improvements.
Conclusion
Updating your Laravel project can be a time-consuming task, but it is essential for maintaining a secure and efficient application. By following these steps and guidelines, you can minimize risks while taking advantage of the latest Laravel features. If you need further assistance or face issues during this process, kindly refer to our comprehensive guides at https://laravelcompany.com/blog/category/laravel-updates for specific tutorials.