composer require laravelcollective html 'doesnt download dependancy - php

Please see when When I run composer install please assist,
I am new to laravel and I cannot download dependency for laravelcollective/html ... I am using laravel 5.5.13
I want to require laravelcollective/html
however I face the following problems.
when I run : composer require "laravelcollective/html:5.2.*",
I get the below mentioned(similarly when I run composer update ) :
C:\Users\MALULEKE\Desktop\lara_proj\shops>composer require "laravelcollective/html:5.2.*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package laravelcollective/html could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
C:\Users\MALULEKE\Desktop\lara_proj\shops>composer require "laravelcollective/html:5.2.*"
below is my composer.json relative to my project's work (not from composer/roaming, I am not even sure which is it I must use, please help )
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*#dev",
"laravel/tinker": "~1.0",
"laravelcollective/html":"~5.3.#dev"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}

Try running composer require laravelcollective/html which will install the latest version of LaravelCollective packages for you.

I have decided to use AngularJS as my front end.
Note that this solution may not be suitable for everyone, and with this solution, problems may arrive in future, due to the need for other composer requirements, such as authentication dependencies that my be needed.

Related

Composer installs only what's in the require and require-dev blocks and not the dependencies when using local repository

Under regular circumstances, if I delete the vendor folder and the composer.lock file, and then run composer install, it will re-install everything, including the dependencies for the packages in the require and require-dev block. But when I use composer install from my local repository, it only installs what's inside require and require-dev.
This is an example composer.json of a clean Laravel 9 project:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-update-cmd": [
"#php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
If I run composer install and set my local repository (add the following to composer.json):
"repositories": [ { "type": "composer", "url": "http://localhost/" } ],
it will install only the 11 packages defined above inside require and required-dev, but not their dependencies. Then it will throw an error about missing things:
> #php artisan vendor:publish --tag=laravel-assets --ansi --force
Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found
Why does this happen? My local repository should work because when I compare the 11 packages installed by my local repository to the same 11 packages when installed by Packagist, they are the same, so I know my local repository should have the correct packages
(And of course the local repository also contains the rest of the packages, not the these 11)
I found the solution, to anyone encounters this problem in the future: even though each package zip file contains the composer.json file, it's not enough, since Satis does not read from that file, instead it reads the metadata from your repository.
So it's important to setup your satis.json to include all metadata fields that are required for Composer to work, so called root fields.
In my case I only used require and autoload fields in satis.json, which caused the issue.
After adding all the fields necessary - require, autoload, conflict, replace, provide and suggest, everything worked!
Not all packages have all these fields, I wrote a script to add only the present fields

Can't make "composer require laravel/ui --dev" on laravel 6.5.1

I am getting following error :
Can't make "composer require laravel/ui --dev" on laravel 6.5.1. I get an error
"Your requirements could not be resolved to an installable set of packages.
Problem 1:
Conclusion: remove laravel/framework v6.5.1
Conclusion: don't install laravel/framework v6.5.1
Installation failed, reverting ./composer.json to its original content.
In my composer.json
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.2.0",
"tcg/voyager": "^1.3"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"repositories": {
"hooks": {
"type": "composer",
"url": "https://larapack.io"
}
}
}
Php version 7.2.25
Please, help.
Version 2 of laravel/ui isn't compatible with version 6 of Laravel so installs the version 1 with composer require laravel/ui="1.*" --dev
The command to implement Auth is as follows:
composer require laravel/ui
php artisan ui vue --auth
OR
composer require laravel/ui --dev
php artisan ui vue --auth
If your Login and Register page only shows plain HTML. And CSS is not loading properly then run this two command:
npm install
npm run dev
Try this command, it worked for me:
$ composer require laravel/ui "^1.2"
composer require laravel/ui "^1.2" works...laravel 6 versions can only run
laravel/ui 1.2.0:
See Packagist for older versions
https://packagist.org/packages/laravel/ui#v1.2.0. ----------------------
Also check out laravel 6 docs
https://laravel.com/docs/6.x/frontend -----------------------
I faced the same issue with laravel 6.17. You can try to use this command instead :
composer require laravel/ui="1.*" - -dev
In my conclusion that laravel 6.x not compatible with laravel/ui version ^2.0. That command works for me.

composer global require fails where non global equivalent succeeds

Im developing a package available at packagist as user/package. Installing it locally works just fine
composer require user/package
Creating a new project is also fine
composer create-project --prefer-dist user/package new-project
But the package is to be deployed globally
composer global require user/package
however this results in the following error log.
Changed current directory to /home/anders/.composer ./composer.json
has been updated Loading composer repositories with package
information Updating dependencies (including require-dev) Your
requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for user/package ^v0.0.3 -> satisfiable by user/package[v0.0.3].
- Conclusion: remove illuminate/container v5.5.2
- Conclusion: don't install illuminate/container v5.5.2
- don't install tightenco/collect v5.4.33|don't install laravel/framework v5.5.2
- don't install laravel/framework v5.5.2|remove tightenco/collect v5.4.33
- Installation request for illuminate/container (installed at v5.5.2) -> satisfiable by illuminate/container[v5.5.2],
laravel/framework[v5.5.2].
- Installation request for tightenco/collect (installed at v5.4.33) -> satisfiable by tightenco/collect[v5.4.33].
Installation failed, reverting ./composer.json to its original
content.
How can this be?
I have tried composer global clearcache
Deleted a composer.lock file I found directly under /home/anders/.composer/
Upgraded my dependencies (Laravel) from 5.5.x to 5.6.x with no effect
Even creating a fresh "laravel new blog" project and uploading to packagist fails with the same error message.
Here is my composer.json
{
"name": "user/package",
"description": "Package",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"ajthinking/tinx": "^2.1",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"bin": [
"package"
]
}
Would really appreciate help interpreting the error log. Thanks!
Update
This is the content of /home/anders/.composer/
{
"require": {
"cpriego/valet-linux": "^2.0",
"laravel/installer": "^1.4",
"phpunit/phpunit": "^6.4",
"phpunit/dbunit": "^3.0"
}
}
Composer version: 1.6.5
If this is standalone tool, you should consider building PHAR for it. You can use kherge/box to simplify build process.
PHAR archive is completely standalone, so you'll get rid of all problems with conflicting global dependencies. It may also simplify installation (you need to just download archive and make it executable) for both global and local installation.

Laravel Update / install composer package

Can you answer me?
I use the latest version of Laravel and I want to add to my project the PayPal service.
I want to install some package to Laravel and added this 2 rows to composer.json
"guzzlehttp/guzzle": "~5.2",
"paypal/rest-api-sdk-php": "*"
My composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"/usr/local/bin/php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"/usr/local/bin/php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"/usr/local/bin/php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true,
"cache-dir": "/home/iamdevco/public_html/norrisms/designer/cache"
},
"guzzlehttp/guzzle": "~5.2",
"paypal/rest-api-sdk-php": "*"
}
but I get this error after download packages
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
/usr/local/bin/php artisan package:discover
The system cannot find the path specified.
Script /usr/local/bin/php artisan package:discover handling the post-autoload-dump event returned with error code 1
after you install all packages run
composer dumpautoload
packages
composer require guzzlehttp/guzzle-services
composer require paypal/rest-api-sdk-php
composer dumpautoload
Rather than manually writing the composer.json, try installing and adding them with the specific commands. Like this.
composer require paypal/rest-api-sdk-php
composer require guzzlehttp/guzzle
That way, you'll avoid any typos and composer.json file will be kept as pure as possible.
Try this composer require paypal/rest-api-sdk-php
Ref: https://packagist.org/packages/paypal/rest-api-sdk-php
Edit:
remove the paypal/rest-api-sdk-php on the composer.json and the guzzle then try this
composer require guzzlehttp/guzzle

Composer hangs on "Resolving dependencies on SAT" between Moodle and Laravel used as a local plugin

I'm using a Laravel project as a local plugin of Moodle, using the composer/installer package. The layout of the project is:
// Moodle Application
- composer.json
- local/
- laravel-plugin/ <- here is the Laravel local plugin
- composer.json <- composer.json of Laravel plugin
The composer.json of the Moodle application
{
"name": "moodle/moodle",
"license": "GPL-3.0",
"description": "Moodle - the world's open source learning platform",
"type": "project",
"homepage": "https://moodle.org",
"require": {
"composer/installers": "~1.0",
"Pursuittech/sam": "dev-master" <- here is the Laravel local plugin
},
"require-dev": {
"phpunit/phpunit": "5.5.*",
"phpunit/dbUnit": "1.4.*",
"moodlehq/behat-extension": "3.33.1",
"mikey179/vfsStream": "^1.6"
},
"repositories": [
{
"type": "vcs",
"url": "git#github.com:Pursuittech/sam.git"
}
]
}
composer.json of the Laravel local plugin
{
"name": "Pursuittech/sam",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "moodle-local",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"composer/installers": "~1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"Api\\": "api/",
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
When I try to install the Laravel plugin using php composer.phar -vvv update, I hang on "Resolving dependencies through SAT".
I found a similar question which has the problem when only dealing with Laravel 4.2 in isolation. I haven't been through everything in the list and will update when I have.
My question is, is it normal for "Resolving dependencies through SAT" to hang when combining large composer projects like Laravel and Moodle? Are there any immediate steps I can take to reduce the complexity of the problem?
try those steps maybe you will get more reasonable output, its probably conflict of package version (eg. one of the packages locked on version which does not satisfy other package)
try no-dev option first
composer update --no-dev -vvv
try updating package by package
composer update some/package --no-dev -vvv
try to delete vendor folder and composer.lock
finally check composer.json of each package and compare requirements search for versions which exclude themselves from working together

Categories