I am new to laravel and I am trying to install laravelcollective. I am just following to documentation here and I am using this from my project directory:
composer require "laravelcollective/html":"^5.4.0"
Unfortunately, immediately after I press ented I get the following error :
[UnexpectedValueException]
Could not parse version constraint :5.4.0: Invalid version string ":5.4.0"
I just don't know how to troubleshoot this. I didn't find much on google and this combined with my lack of experience with laravel leaves me stuck.
Can someone help?
You can add it manually in composer.json then use composer update.
Just add "laravelcollective/html": "5.4.*", under the row with "laravel/framework":"5.4.*",
Like this :
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.4.*",
"laravelcollective/html": "5.4.*", <-- Add this row
"laravel/tinker": "~1.0"
},
You should never run composer update without any arguments if you do not want to update all your dependencies.
In your case, the issue probably is that the ^ character is already interpreted by your shell before the argument is passed to Composer. This could possibly be solved by using single quotes instead of double quotes:
composer require 'laravelcollective/html:^5.4.0'
When you used the 5.4.* constraint as suggested in one of the comments above, you added a space after the colon which leads to Composer interpreting the version constraint as a package name. The right command would have been this:
composer require "laravelcollective/html":"5.4.*"
composer require "laravelcollective/html ^5.4.0"
Worked for me!
In my case, I was using Laravel 5.7 and kept getting an error when trying to install the Laravel collective.
You can use this command without specifying any version:
composer require 'laravelcollective/html'
It worked for me. :)
Related
I have a Project https://github.com/javedbaloch4/Laravel-Booking developed in Laravel 5.6 now I want to upgrade it to Laravel 6. What are the steps can I directly update to 6 or first goto 5.7, 5.8 and then.
Please can guide the steps here for a quickly upgrade Thanks.
Step 1 : Remove the followings from your composer.json file
"laravelcollective/html": "^5.4.0",
"yajra/laravel-datatables-oracle": "^8.4"
Step 2 : Replace this line
"laravel/framework": "5.6.*",
To this
"laravel/framework": "^6.0",
Step 3 : Run Following commands in order
composer require laravel/helpers
composer require laravelcollective/html
composer require yajra/laravel-datatables-oracle
composer require yajra/laravel-datatables-buttons
composer require yajra/laravel-datatables-html
composer require yajra/laravel-datatables-fractal
composer require yajra/laravel-datatables-editor
composer update
composer dumpa
Key Point to notice and understand is whenever you want to upgrade
make sure all the packages you're using have compatibility with correct versions of laravel and php. Check and follow the repo. on git to get notified if any new upgrades are there.
That's It, You're Good to go.
The official framework documentation tells you exactly how to upgrade:
https://laravel.com/docs/5.7/upgrade
https://laravel.com/docs/5.8/upgrade
https://laravel.com/docs/6.x/upgrade
https://laravel.com/docs/7.x/upgrade
You can also use https://laravelshift.com if you need any automatized solution.
I have a Symfony 4 project and am trying to install this package for working with AWS DynamoDB.
When I run composer require oasis/dynamodb-odm I get an error saying oasis/dynamodb-odm v0.5.3 requires symfony/console ^3.2 -> no matching package found. Attempting to run composer require symfony/console:^3.2 also results in the "Could not find package..." error.
As I am using Symfony 4, composer commands are intercepted by Symfony Flex and some extra stuff happens. Interestingly, there is a Flex recipe for symfony/console:3.3 but not 3.2 which I imagine might be the problem.
My understanding of the caret is that it should allow minor version bumps, so I wonder why console v3.3 is not installed instead.
I would like to use this package, and there aren't many DynamoDB PHP offerings out there, so how can I resolve this issue?
if you checkout the composer.json file of the package, you can see the following
"require" : {
"php" : ">=5.6",
"doctrine/annotations": "^1.4",
"oasis/aws-wrappers" : "^2.10",
"oasis/logging" : "^1.0",
"doctrine/common" : "^2.7",
"symfony/console" : "^3.2",
"symfony/finder" : "^3.2"
},
meaning it is compatible with symfony3 only.
Probably you can fork the repo and try changing the version numbers and test it. If it works you can install it.
I have a problem with laravel and composer package yajra/laravel-datatables
Here is my require part from composer.json:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"cartalyst/sentinel": "^2.0",
"laravelcollective/html": "^5.2",
"yajra/laravel-datatables-oracle": "^6.1"
},
After executing composer update all passes fine and I can check that inside vendor dir has appeared yajra folder.
After that I have add new provider in app.php:
yajra\Datatables\DatatablesServiceProvider::class
and then run php artisan but followingerror appears in the console:
Class 'yajra\Datatables\DatatablesServiceProvider' not found
I can fix this error by editing autoload_classmap.php file and manually add
'yajra\\Datatables\\DatatablesServiceProvider' => $vendorDir . '/yajra/laravel-datatables-oracle/src/DatatablesServiceProvider.php',
Anyway, the next time I execute composer update this line is deleted and again appears the same error and I again have to manually edit autoload_classmap.php file.
There is something wrong which causes composer update to not update relevant autoload files. I can not get it what is going on.
You should use in your app.php
Yajra\Datatables\DatatablesServiceProvider::class
instead of
yajra\Datatables\DatatablesServiceProvider::class
(with capital letter)
Try removing syntactic sugar operators like tilde and caret sign in composer.json. Because sometimes they do not allow the exact version to install. The same problem happened to me also. Then run,
comoposer update
Solved the issue for me.
Solved: I've added the php and illuminate/support packages into my package composer.json file and it started working. I've got no idea why though so if someone could explain, I would really appreciate it.
"require": {
"php": ">=5.4.0",
"illuminate/support": "~5.0"
},
I've created a composer package for Laravel 5 which should generate models based on an existing database schema. However i'm unable to load it in.
I add my Command class into the app/Console/Kernel.php
'Iber\Generator\Commands\MakeModelsCommand'
But then I get the following error:
Class Iber\Generator\Commands\MakeModelsCommand does not exist
I'm really new to Laravel and I'm not sure why this is happening since composer generates the autoloader file just fine. I've created and added (into config/app.php) a Service Provider but that doesn't get resolved either. Not sure what I'm doing wrong.
Here's the package:
https://github.com/ignasbernotas/laravel-model-generator
Apparently adding the required attribute with the following packages solved the issue. I'm still not sure why.
"require": {
"php": ">=5.4.0",
"illuminate/support": "~5.0"
},
I just added a new package to my composer.json in Laravel4 --
"barryvdh/laravel-dompdf": "0.4.*"
and on doing command line "composer update", I got this warning:
PHP Warning: Unexpected character in input: ' in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php on line 118
which I've never seen before on all previous Composer updates, which have all been flawless. In fact, the exact same message appeared 6 times, so I'm assuming that this reflects multiple attempts by Composer.
Here's my "require" array in composer.json:
"require": {
"laravel/framework": "4.2.*",
"barryvdh/laravel-dompdf": "0.4.*"
},
Am I correct in assuming that this relates to bad code in the package I've added, and not something on my end? The only change I made was to add the package to my composer.json file, and that's clearly not what the error message refers to. Thanks.
Take the package out of your composer file, and then do:
composer update
Then, add a different package, if you need an example: use Jefferey Way's laravel generator:
"way/generators": "2.*"
which every laravel install should have. if it runs through correctly, post an issue on the conflicted packages github about the error.
I apologize that i cant give you an exact answer, but unit testing the conflicting package is outside the scope of the question