Error and warning while installing CodeIgniter through Composer - php

I tried to install CodeIgniter through composer using this:
composer require bcit-ci/CodeIgniter
And it installed successfully I got a warning, see screenshot
And then I tried to install with this:
composer require codeigniter/framework
and I got a fatal error, see screenshot here
I don't know what I am doing wrong.
See all screenshots here: http://imgur.com/a/zsnER

I just removed the cache of Composer and tried to install again and I got success.

this is weird that composer trying to install the very first package 1.0.0 , works perfectly at my side.
however , you will need to pass the package version statically as follows:
composer require codeigniter/framework:"3.1-stable"
this will often -till the answer date- install 3.1.0 version,
you may try to download the latest version :
composer require codeigniter/framework:"3.1.4"

Related

Laravel composer install giving error "Your lock file does not contain a compatible set of packages please run composer update"

I have been writing laravel code for quite sometime. Currently, I tried cloning a project from github and editing locally. I installed composer in my project directory but a vendor folder was not included, I tried to run composer install but I gives me this error
Your lock file does not contain a compatible set of packages. Please run composer update
How do I resolve this?
Note: I have tried running composer update on previous clones and that didn't work.
Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Disclaimer, this solution will not fix the issue for PHP 8 projects.
In most cases this happens because of PHP 8 (In my case it was GitHub CI actions automatically started using PHP 8 even though my project is php 7.4)
If you have multiple PHP installations (E.g. 7.4 and 8 on the same server), this is how you can fix it.
Specify your php version in your composer.json file
"config": {
"platform": {
"php": "7.3"
}
},
If you have the lock file already committed, run composer update after you adding above line in to the composer.json and then commit the new lock file. (Please be aware composer update will upgrade your packages to latest versions)
I solved this problem with this command:
composer self-update --1
It probably works because at time that the project was developed, composer was on another version and when change the Major version from 1 to 2 the compatibility was broke. With this command you downgrade composer and probably going to solve this
You should try running composer update --lock that will update all packages and recreate the compose.lock file.
Either you can delete the composer.lock file and run composer install that will also recreate the .lock file.
This resolved my issue.
I had this error with Github Actions trying to deploy a Laravel app, this is probably different than the OP's case but none of the suggestions worked for me. Adding my answer here just in case there is someone else out there with a similar problem to mine.
I had to disable -q in Github Actions and see that it was complaining about extensions not being installed.
Make sure your require section of composer's php extensions matches the extensions: in your github action file for shivammathur/setup-php#v2 and it will deploy again
Recently I've just come across of this error when I tried to run my Laravel 7 project which required php v7.* with php v8. As I forgot my php version I just tried bunch of composer command, but just got error after error.
Anyway, to solve this just downgrade/upgrade php version as required. Just search how to do that in youtube.
you can see your project required php version in composer.json file (just if you wonder)
Also you can try following way (But though it didn't worked for me, seems it helped quite some people)
-- Open composer.json file and change php version to something like this: "php": "^7.3|^8.1"
-- Then run composer update
I faced this problem with my cakephp project in garuda linux (arch based)
Fix :
Install php-intl using sudo pacman -S php-intl
Enable php intl by editing php config ( in my case /etc/php/php.ini ) .
add extension=intl or uncomment the existing one
restart apache or whatever you are using
I had the same error deploying another project with composer, but the problem was a missing php extension.
I understand you solve your problem but for anyone seeing the same error message, here is a general guidance :
The error message Your lock file does not contain a compatible set of packages. Please run composer update is shown each time there is a conflict during the dependency solving step of composer install. (see the relevant part in composer source code)
It doesn't inform on the real problem though, and it could be hard to guess.
To get the exact explanation you can add --verbose option to composer install command (the option is available to any composer command (see the doc)) : composer install --verbose
It will give you the full message explaining what exactly is preventing composer install from completing (package version conflict, missing php extension, etc.), then you'll be able to fix the problem.
Hope this could help.
In my case this problem is occuring in Ubuntu 20.04 Desktop. This is due to some missing packages.
I ran the following commands to install some packages then rerun Composer install and its working properly. The commands are:
sudo apt-get install php-mbstring
sudo apt-get install php-xml
Then rerun composer install

How to fix this scsuoft/laravel-exception-notification error?

I am using PHP version 7.2.19 and Laravel 5.6.39. I am getting this scsuoft/laravel-exception-notification error when I run composer install.
When I check the link it is not available and I also try to delete the scsuoft file manually but when I run composer install again the file is automatically added and I keep getting the same error.
Also, if I try composer require jeremykenedy/laravel-exception-notifier
Try composer require jeremykenedy/laravel-exception-notifier. After some digging i found there's no scsuoft/laravel-exception-notification anywhere.

Composer installation order

Is it possible to set the installation order?
Currently I'm using Doctrine module that requires ext-mongo to be installed, but as I'm using the newer php version (7.0) I have mongodb installed instead. There's a alcaeus/mongo-php-adapter package that resolves installation problems. But there's one problem - Composer is trying to install Doctrine modules first, so that installation fails.
Currently I have to resolve this problem manually, but I can't do it any more as I'm going to pack my environment to a Docker image to let it be automatically deployed later.
From the docs of alcaeus/mongo-php-adapter
"
$ composer require alcaeus/mongo-php-adapter
If your project already has a dependency on ext-mongo, the command above may not work. This is due to a bug in composer, see https://github.com/composer/composer/issues/5030
To fix this, you can use the --ignore-platform-reqs switch when running the above command, or when running composer update with no composer.lock file present."

Composer BowerPHP Error

I am trying to install BowerPHP in my Laravel framework project on my computer using Composer. I have used the composer require "beelab/bowerphp 0.3.*#beta" command in the command prompt but I'm receiving errors:
Can only install one of : symfony/process[v2.7.9,v3.0.2]
Can only install one of : symfony/process[v2.7.8,v3.0.2]
Can only install one of : symfony/process[v2.7.7,v3.0.2]
etc.
From what I understand my framework already has a version of Symfony and I cannot download another package. In addition, the package that I have is not compatible with BowerPHP. What do I do? And am I correct?
So I found the answer. The beelab team did not update their own website but did update their github page. running the composer require beelab/bowerphp:1.0.*#dev would work but running the on on their website would not.

How to force a package to be installed?

I'm trying to install the following package through composer:
https://packagist.org/packages/cartalyst/sentry#dev-feature/laravel-5
When I do:
composer require cartalyst/sentry dev-feature/laravel-5
I always receive this error:
[InvalidArgumentException]
Could not find package dev-feature/laravel-5 at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
If I change minimum-stability to dev it will still complain.
However, if I install dev-master and manually merge the files from dev-feature/laravel-5 into dev-master, it works fine.
Hence why I'm asking how to force this package to be installed via composer.
To force the installation of this package, I added the following to the require element of composer.json:
"cartalyst/sentry":"dev-feature/laravel-5 as 2.1.4"
Below is the link from where I found this suggestion:
http://vvv.tobiassjosten.net/php/have-composer-use-development-branches/
It will not work from the command line, must be through composer.json. That I don't know why.
Update:
I believe I was wrong in my last statement above, actually something like the following will work from the command line:
composer require "codeception/codeception":"2.1.0-rc1 as 2.0.9"
Try to use this
composer require "cartalyst/sentry": "2.0.*#dev"
I believe sentry is not fully compatible with Laravel 5 yet

Categories