How to know Laravel version and where is it defined?
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Understanding Laravel Versions: Where are They Defined and How to Identify Them?
Introduction:
Laravel is an open-source PHP framework with built-in solutions for various development tasks, such as authentication, routing, caching, queueing, sessions, and more. It's essential to know where Laravel versions are defined and how to identify them to ensure your project runs smoothly. In this blog post, we will explore the basics of knowing and managing Laravel versioning, with a special focus on understanding the relationship between the application directory and global server-side directories.
What is Laravel Version?
The Laravel framework offers regular updates called "releases." A release has a specific version number which includes information about enhancements, bug fixes, and security improvements. This versioning system allows developers to identify and maintain compatibility between different versions of the framework.
Where are Laravel Versions Defined?
Laravel's version is primarily defined in the application's "composer.json" file, the configuration file for Composer, a dependency management tool for PHP. The composer.json file contains information about your project, including dependencies that you want to use, the required Laravel framework and its version.
Finding Laravel Version in Your Application Directory:
1. Open your project directory's "composer.json" file using a text editor or IDE.
2. Locate the following line: `"require": {`
3. Find the Laravel framework requirements within this section, typically preceded by "laravel/framework:" as in `"laravel/framework": "^9.0",`. Here, version 9.0 represents the required Laravel version for your application.
4. If you don't have a composer.json file or can't locate it, this might mean that your project isn't using Composer and the Laravel framework. In such cases, check if there exists a "composer.lock" file in the same directory. This is where Composer stores the versions of all dependencies for a specific project.
Identifying Laravel Version through Command Line:
1. Open your terminal or command prompt and navigate to your project's root directory.
2. Run the following command: `php artisan --version`. This will display the current Laravel version installed on your system, which might differ from the required version defined in your composer.json file.
- If you get an error like "php: command not found," make sure to install PHP-CLI (Command Line Interface) on your machine before moving ahead.
3. In case of multiple Laravel versions installed and you wish to run a specific one, use `which php` to see the active location of your PHP binary or update your PATH environment variable accordingly.
4. To check all known PHP versions in your system, run `php -v`. This will showcase all available PHP versions, with their respective paths and details.
Knowing Who Changed Laravel's Version on Your Site:
1. If you work on a team or collaborate with other developers, it is crucial to maintain the version history of your project. Keep track of when and why a specific Laravel version was changed in the project.
2. Include this information in your project documentation or within version control systems like GitHub, Bitbucket, or GitLab. This allows other team members or collaborators to easily understand the changes made and maintain consistency across different versions.
3. If you have access to the git repository's history, you can revert changes using `git reflog` or `git log`. In case of a pull request, review the commit messages for any notes about version upgrades.
4. Be sure to update the composer.json file after making any version change and commit your updates in your source control system.
Conclusion:
Understanding where Laravel versions are defined is essential for maintaining a stable application environment. By knowing how to identify them, you can ensure that your project runs smoothly with the latest framework features. Keep track of your Laravel version history, and involve your team members or collaborators in decision-making processes to achieve consistency across your development workflow. With these practices, you'll be better equipped to manage the software lifecycle of your Laravel-based applications.