How to know Laravel version and where is it defined?
Is Laravel version is defined inside my application directory or somewhere in global server side directory?
UPDATE
Sorry, the main question is where the version is defined? Where does
php artisan --version
takes it's answer?
UPDATE 2
The goal is to investigate, who (of us) has changed Laravel version on our site. Could it be changed by github repository edition only? Or server write access was also required?
run php artisan --version from your console.
The version string is defined here:
https://github.com/laravel/framework/blob/master/src/Illuminate/Foundation/Application.php
/**
* The Laravel framework version.
*
* #var string
*/
const VERSION = '5.5-dev';
1) php artisan -V
2) php artisan --version
AND its define at the composer.json file
"require": {
...........
"laravel/framework": "^6.2",
...........
},
If you want to know the specific version then you need to check composer.lock file and search For
"name": "laravel/framework",
you will find your version in next line
"version": "v5.7.9",
If you want to know the user version in your code, then you can use using app() helper function
app()->version();
It is defined in this file ../src/Illuminate/Foundation/Application.php
Hope it will help :)
CASE - 1
Run this command in your project..
php artisan --version
You will get version of laravel installed in your system like this..
CASE - 2
Also you can check laravel version in the composer.json file in root directory.
Step 1:
go to: /vendor/laravel/framework/src.Illuminate/Foundation:
Step 2:
Open application.php file
Step 3:
Search for "version". The below indicates the version.
Run this command in your project folder location in cmd
php artisan --version
Yet another way is to read the composer.json file, but it can end with wildcard character *
Multiple way we can find out laravel version such as,
Using Command
php artisan --version
or
php artisan -v
From Composer.json
From Vendor Directory
/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
In your Laravel deployment it would be
/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
to see who changed your Laravel version look at what's defined in composer.json. If you have "laravel/framework": "5.4.*", then it will update to the latest after composer update is run. Composer.lock is the file that results from running a composer update, so really see who last one to modify the composer.json file was (hopefully you have that in version control). You can read more about it here https://getcomposer.org/doc/01-basic-usage.md
You can also check with composer:
composer show laravel/framework
If you're like me and want to show the Laravel version and app version on the footer you can create a Blade directive in AppServiceProvider. Blade directives are placed in the boot method of the AppServiceProvider and example code may like something like
Blade::directive('laravelVersion', function () {
return "<?php echo app()->version(); ?>";
});
then in the blade template, you call it like #laravelVersion and it will show the current laravel version.
If you want, you can read more about blade directive here
You can find this on Composer.json file -> root directory
You can view the result of dd(\Illuminate\Foundation\Application::VERSION)
I have a question to ask about laravel: How to tell what version of laravel from the laravel full files?
I have a laravel files which I cannot tell what version is it.
Go to project root directory and run php artisan command. The output will start from something like:
Laravel Framework version 5.3.30
5.3.30 is the version of Laravel used in this project.
Go to Your project's root directory in command prompt and hit command like:
php artisan -V
You will get your laravel version Laravel Framework version 5.3.30 like that
If you can't or don't want to use artisan (php artisan --version), open vendor/laravel/framework/src/Illuminate/Foundation/Application.php you will find const VERSION = '...'; defined in the class.
I have installed some packages that have migrations in their vendor folders, previously one of the packages I used published these migrations to migrations folder by running:
php artisan vendor:publish
Now I found alteast 2 packages that no longer published migrations when running this command, so I went into vendor folder and grabbed migration file and manually moved it and when I run
composer dump-autoload I got a warrning message from it that said: Warning:
Ambiguous class resolution, "CreateRevisionsTable" was found in both "$baseDir . '/database/migrations/2013_04_09_062329_create_revisions_table.php" and "C:\xampp\htdocs\example\vendor/venturecraft/revisionable/src/migrations\2013_04_09_062329_create_revisions_table.php", the first will be used.
why is this happening? Has something changed in 5.4?
Yes, since version 5.4 Laravel supports loading migrations from any directory.
$this->loadMigrationsFrom(__DIR__.'/path/to/migrations');
Which could be used by a service provider of any package.
i figured out too late that way generators version 3 package is not compatible with laravel version 4.2 it only work with laravel 5, now i need to switch to a previous version of the package and i do not know how to do it properly as my laravel project is in the half way.
Thank you so much for any further help
Update your composer.json file to use "way/generators": "~2.0". Once that is done, run the following command:
composer update "way/generators" --dev
By providing the package name to the composer command, composer will only update the specified package.
I tried to install Sentry 2 with composer. I used the composer manuel from the sentry site,
but i got always a serviceprovider exception:
"Class 'Cartalyst\Sentry\SentryServiceProvider' not found"
Is there an another way or i did something wrong?
If you look closely on the [Sentry website installer instructions for laravel 4],
step one states that you need to add "cartalyst/sentry": "2.0.*" to your composer.json,
but it also specifically states that it requires you to run php composer.phar update from the command line
Note that you should run php composer.phar update BEFORE you add the entries for the app/config/app.php (before proceeding to steps 2 and above)
#Todd Isaacs's answer would also lead you to the required result but you do not need to go back to the beggining, all you have to do is revert the changes on your app/config/app.php file and run the update.
hope that helps.
I found the solution. SSL is necessary for composer update and now all works fine.
So I checked the php ini and set ssl on.
I just got this same error and being totally new at Laravel I decided to step back, here is what I did to resolve it.
removed the entries I added to my composer.json and app.php (I think app.php was the issue)
run composer update (yep worked this time)
added "cartalyst/sentry": "2.0.*" to my composer.json
run composer update (sentry was installed)
added 'Cartalyst\Sentry\SentryServiceProvider' and 'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry' to my app.php
run composer update (still works)
When I originally installed Sentry I added the 'Cartalyst\Sentry\SentryServiceProvider' to the app.php before running the update and I think this was the issue. ( install instructions )
For Sentry 3, change the service provider in app/config/app.php to:
'Cartalyst\Sentry\Laravel\SentryServiceProvider',