Sometime happens that you do everything that read me file said and still you get errors like class not found or file not found because you are getting just different version of package. The conman reason is below here. That might be unnoticed if you are beginner.
Composer Requirement Mismatch
Laravel packages are created by experienced Larvael and php developers. They are best at their work. But when we use that packages we get errors because we don't find out exact requirement for that package or at least for the particular version of the package.
- requirement of the Laravel version
- requirement of the php version.
There are many packages which have different versions for the different laravel version or for different php version.
- vinkla/Instagram etc.
We will go with example of spatie/laravel-analytics package because it is the package made me aware of this.
When you install package by composer require you will get the latest release by the requirement fulfilled by your project.
|Package release list
On GitHub click on the releases and you will get a tree of the every released versions of that package just click on the commit number show in the left side and you will get the files of that particular version just go and check what was the requirement of that particular release was and do you able to fulfill that.
Here the example of release 2.4.0 and 1.4.1 of laravel-analytics
|Portion of composer.json of laravel-analytics 2.4.0
At this moment Laravel-Analytics package has latest version of 2.4.0 that requires php 7.0, so if you have php 7.0 on you system you will get version 2.4.0. But if you are using php 5.4 then you will get 1.4.1 version. How to check version for that particular release is just open the composer.json file of that release.
|Portion of composer.json of laravel-analytics 1.3.0
Here is the portion of the composer.json file of laravel-analyics release 1.4.1, which says that it require php 5.4 or up so if you have php 5.4 installed you will get laravel-analytics 1.4.1 insatlled.
Here is the link of the laravel-analytics 1.4.1 version.
Here is the portion of the composer.json file of laravel-analyics release 1.4.1, which says that it require php 5.4 or up so if you have php 5.4 installed you will get laravel-analytics 1.4.1 installed.
Here is the link of the laravel-anlytics 2.4.0 version
This is the reason you do everything that read me file said and still you get errors like class not found or file not found because you are getting just different version of package
For more about laravel-analytics package.