any of composer require command not working - laravel

I am using Laravel Valet to creating laravel application because suddenly composer "create-project --prefer-dist laravel/laravel blog" not working.
require command not working.
so I install the valet
The composer is successfully installed on my device Globally. i Follow stap from laravel valet doc to setup composer.
Problem is after composer require command it takes minimum 5min to load
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
and nothing happened I wait 30min and not error or no output
check images composer installed
again wait for 1hour no output and no error
one more example
now how to fix it

This looks like a network error. You should check your network settings, double check if you have access. (I think you have because you posted this question)
There could also be something wrong with the installed composer repositories. If one of those is unavailable it will take forever to load all repositories/search for a repository. You can check which repositories are used with the following command:
composer -g config repositories
composer config repositories

It solved. It was my broadband problem. The connection was alright but it was not able to download package. now it's working.

Related

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5"

I'm trying to upload a plain laravel v5.8 project to a server. It gives me this error
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5".
I updated the Laravel version to v6 and it still throws the same thing.
Is there any possible solution I tried many but nothing happens. Thanks in advance.
I faced this problem using the new version of composer, didn't have seen this issue before, although this question is a bit old the solution can help someone else.
I did this working in a development machine, if you really need to change the PHP version running in your server this isn't for you.
This problem is related to a composer configuration when you run the command "composer install" if you need to work with the configuration you already have and don't want to make changes which could lead to other problems you should:
remove the packages you already have installed which includes this configuration from composer
sudo rm -r vendor
run the command again with this flag: --ignore-platform-reqs
composer install --ignore-platform-reqs
Now composer won't perform this check anymore and you are good to go!

Can not download Laravel UI package

I want to download Laravel UI package via composer and I have got this error
Seems like due to internet issue you can't access packagists site (which composer uses to get the packages) which is causing the installation to fail.
run a fresh composer create-project laravel/laravel command, copy replace your composer.json content with the old projects composer.json. Do the same with .env file
and run composer install. then u can run "composer require/laravel/ui"

Laravel create project not working

Am running laravel create project in windows command prompt like, composer create-project laravel/laravel laravel-medium --prefer-dist but am getting error like,
[Composer\Downloader\TransportException]
Your configuration does not allow connections to http://packagist.org/packa
ges.json. See https://getcomposer.org/doc/06-config.md#secure-http for details.
i don't know how to fix this issue. Please help me.
There is a discussion about this here.
You can try to run composer self-update. This will update your composer version and might solve the problem.
If it does not, you could turn ssl off, by running composer config -g secure-http false, however I would not recommend this.

I'm getting error "Class 'Predis\Client' not found" in Laravel 5.2

I want to using Redis in laravel 5.2 however, I'm getting error such a Class 'Predis\Client' not found, How I can solve it.
First download the REDIS to your system (if you haven't already installed it).
Go to the folder where you have downloaded the redis and run this command:
cd your-redis-folder-name
make
Go to your project directory and install composer:
composer require predis/predis
Go to your .env file and add Queue driver:
QUEUE_DRIVER=redis
use Mail::queue() to send mail via queue. See Doc.
And in your terminal run:
php artisan queue:listen
to send.
Write in console in project folder:
composer require predis/predis
And thats all.
You need to add predis/predis into composer.json for your project. Reference: https://laravel.com/docs/5.2/redis#introduction
Btw, if you are using laravel workers, with ubuntu supervisor and this error will not dissappear even after you did
composer require predis/predis
Then remember kids, that supervisor caches all your php code, once you boot it. So installing predis after you booted supervisor workers (https://laravel.com/docs/5.6/queues#supervisor-configuration), will not make a difference, until you do
sudo supervisorctl stop laravel-worker:*
and then start it again
sudo supervisorctl start laravel-worker:*
I've been stuck on this for an hour or two, on 3 projects in the last year.
we have add composer.json file "predis/predis": "~1.0" help working fine.
I solved the problem just including the use Predis; above class file in app folder.
If you installed predis via composer require predis/predis already.
you can also try to run Redis as a local server, download this and run the run Redis server file
if you still get it use composer require predis/predis
Running composer dump after installing predis/predis package might be necessary
It's easy to just look at the path and filename Examples that exist Most of the path name or autoload file name are not spelled correctly
1-go to https://github.com/predis/predis/tags
2-create folder in host by name redis
3-download predis and upload to your website dir (www) in redis
4- create index.php out of the predis folder(redis)
5- past this code for test in index.php
require 'redis/Autoload.php';
Predis\Autoloader::register();
$client = new Predis\Client();
$client->set('foo', 'bar');
$value = $client->get('foo');
echo $value;
My issue was that I updated the .env file through Envoyer to use redis as the session and cache drivers prior to deploying the composer lock file. This was causing composer install to fail on deployment.
Resolved by changing the session and cache drivers back to file, then deploying the updated composer lock file and running composer install, then updated the session and cache drivers back in the .env file back to redis and redeployed again.

Laravel Installer method

Normally I do install Laravel 5.1 by following this command regarding to documentation:
composer create-project laravel/laravel --prefer-dist
It works fine.
But I read in the documentation under "Via Laravel Installer" also it is possible to install via Laravel Installer, which is much faster than installing via Composer:
laravel new blog
But to use this method I need to run following command once:
composer global require "laravel/installer=~1.1"
When I do run it I get following errors many times
Deprecation Notice: Composer\Package\Version\VersionParser::parseLinks
is deprecated. Use \Composer\Package\Loader\ArrayLoader::parseLinks()
instead in
phar://C:/ProgramData/Composer/bin/composer.phar/src/Composer/Package/Version/VersionParser.php:226
after many line of same error ./composer.json has been updated appears and it continues with the same line of errors, it ends with following
Loading composer repositories with package information Updating
dependencies (including require-dev) Nothing to install or update
Generating autoload files
What is wrong with it? Any idea or solution.
My environment: Windows 10, GitBash and cmder console.
Update of composer, I did ran composer self-update also
Snapshot of console
EDIT:
Note, I can confirm after solving the issue that the installation via Laravel Installer method is faster than composer.
The Composer Assets Plugin you've installed locally is using a deprecated method of Composer. The plugin is already fixed, so run composer global update to get the latest versions with the bug fix. After it, you should be able to run the command succesfully.
If this doesn't work (as you might get the same error running the previous command), try removing the global vendor directory. When running any global Composer command, it outputs something like "Changed current directory to XXX". Remove the XXX/vendor directory and then try running the command.
In addition to #WouterJ answer.
Worst case if the steps provided by #WouterJ did not work, you could manage to uninstall and reinstall composer for windows.
When done, run composer global update to be sure to get latest updates, if there was.
Then run composer global require "laravel/installer=~1.1" and it should works.
Remember to update your windows environment path C:\Users\UserName\AppData\Roaming\Composer\vendor\bin

Resources