How can i install yii/jui in yii2.0 using composer. I have tried
php composer.phar require --prefer-dist yiisoft/yii2-jui "*"
and added to composer.json
"yiisoft/yii2-jui": "*"
but it did not succeed. Can anyone help me how to use composer to install extension in yii 2.0 .
When i am running $ php composer.phar require yiisoft/yii2-jui "*" in cmd it is just opening the composer.phar file, nothing else happening.
Thank you in advance.
Please check in composer.json file for yiisoft/yii2-jui under "require". You might be see like that
"require": {
"yiisoft/yii2-jui": "2.0.*#dev"
},
If you didn't see, please add this and run composer.phar install or composer install. If already install, use composer.phar update or composer update
I have been updated my answer. Please take a look. The packagist is Here.
Hopefully, you already installed Yii-2 with composer. I have been installed (basic application template) step by step.
Step 1.
Before installation, Yii official website said that, we require to install this package before installation Yii 2. This step will follow after composer installation.
sudo composer global require "fxp/composer-asset-plugin:1.0.0-beta4"
Please take a look attach file.
This time is yii-2 installation with composer.
sudo composer create-project yiisoft/yii2-app-basic basic 2.0.1
Please take a second and third attach image.
After that, please go to your project folder. Then, open your_project_folder/composer.json. I have been used vi to open compser.json. You can use whatever your prefer. Please take a look again for attach image.
The next step is final step for complete install for your package. After adding this
"yiisoft/yii2-jui": "*"
under require keyword, please save your composer.json file. Then run this command.
sudo composer update
Please take a look attach image again.
Please check your folder on your_project_folder/vender/yiisoft/yii2-jui
That's all. Hope this help for your stack. Btw, if you want to use composer command, please used the following command. This will help to call composer from everywhere.
sudo mv composer.phar /usr/local/bin/composer
I use Windows 10, To install php composer.phar requires --prefer-dist yiisoft/yii2-jui.
Related
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
I got a website which I need to maintain and after looking at the files and code, I thought there are some missing files in project/vendor folder.
After talking to the current maintainer, he told me I need to use composer in order to see those files. I have installed composer but I don't know how to "fill" the folder with the files.
From reading online I understood I need to extract and install dependencies using the composer.json file but even after searching the web for more then an hour I didn't find how to do it.
Go to the root of you project and run
composer install
after that composer will download all package that are in the composer.json file in the require and require-dev section
First, install the composer, take a look here composer, after this try to run composer install, in some cases I do update with composer update too.
Remember to run the command composer install on the same path where composer.json
Apparently I had to install php7.0-curl using the sudo apt-get install php7.0-curl.
After that I just used composer install again and it's good now
I am trying to install the yii2 and after I installed the composer I tried to run composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
it says :
Could not open input file: composer.phar
Any suggestions ?
Make sure of composer work correctly.
php composer.phar -v
Try
php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
I know probably you've figured it out by now but still I want to help.
Make your composer.phar global so you can access it from anywhere. You can set path in environment variables or you can give direct path like below:
php C:\ProgramData\ComposerSetup\bin\composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
Note: I'm using Windows 8.1 and composer is installed in C directory.
First of all install composer in your system Like windows system. you can download composer from this url https://getcomposer.org/download/. after install composer you can go to C:\composer check files for composer.phar and composer.bat files then copy both files and goto C:\xampp\php paste both files here and restart xampp then after that you can install yii2
Hi,
I have just installed a Yii2 basic project from composer. I'm in mac osx yosemite 10.10.
Neverthless i'm trying to install extensions as descrived in the tutorials from Yii guide 2.0 and i cannot do it, simply to the fact that i donĀ“t know where to put the line:
php composer.phar require --prefer-dist arturoliveira/yii2-tileslidemenu "*"
this method says in terminal it cannot find composer.phar.
Where to put the above line ?
When i installed the project "acastro" i wrote in terminal the line:
composer create-project --prefer-dist yiisoft/yii2-app-basic acastro
and the installation worked very well (i had to deal with the mcrypt missing error first but then composer was recognized as a command by termnal)
So, what is the issue here, since nothing installs in vendors dir?
I have tried the other method but nothng happens. The method was:
"arturoliveira/yii2-tileslidemenu": "*"
added in the required section of composr.json file.
When i launch the project by localhost MAMP, nothing is installed in vendors dir.
Anyone can explain me how to install the proper way an extension in Yii2. In Yii1.1 was so easy to do it.
Many thanks in advance.
So if you have global installation of composer and you do composer create-project --prefer-dist yiisoft/yii2-app-basic acastro, than you can do same with that line too:
composer require --prefer-dist arturoliveira/yii2-tileslidemenu "*"
I don't use MAMP, only XAMPP, but as far as I know, you have to manually do composer actions via command line.
I ran into a problem using composer for installing/uninstalling some dependencies in laravel, which come back after deleting them from composer.json and deleting their vendor folder.
I initially used dflydev's markdown package, but now I want to change it to michelf's php-markdown, but I can't uninstall the old one since it comes back loaded from cache. I checked at AppData\Roaming\Composer and it is empty.
Any clue as to why this is happening?
- Installing dflydev/markdown (dev-master dee1f7a)
Loading from cache
You can use the following command to clear the cache irrespective of the OS you are on:
php composer.phar clear-cache
or if composer is installed globally
composer clear-cache
I think, you can run your composer commands with --no-cache option flag like
composer install --no-cache
Or
composer require <package-name> --no-cache
Or
composer update [<package-name>] --no-cache
If you want to clear all packages cache, please try following:
$ composer clearcache
Or to just clear one or a few packages:
$ composer clearcache packagename1 packagename2 ...
You can also use clear-cache which is an alias for clearcache.
Source : https://blog.liplex.de/clear-composer-cache/
composer caches packages under vendor/packagename convention. So you shouldn't run into any issue, just because the packagename is used in another vendor's package.
the cache locations are:
Windows: %LOCALAPPDATA%\Composer\files\vendor\packagename
Linux: ~/.composer/cache/files/vendor/packagename
Mac OS: ~/.composer/cache/files/packagename
Don't edit your composer.json file manually to remove a package - it will remain in composer.lock.
Use composer remove to delete the old package then composer require to install the replacement.
In some cases (for example OpenSuse 42.1) all user cache are puts in:
~/.cache/
For the composer, the same as other applications, the cache path is:
~/.cache/composer/
So, just remove this folder as follow:
rm -fR ~/.cache/composer
run the following command
rm -rf ~/.composer/cache*
if Permission denied add sudo
On Window, I see the composer cache file located in
C:\Users\{your_user}\AppData\Local\Composer\files
It stores ZIP files. The below image has 2 Zip files because I have downloaded 2 versions of monolog (1.0.1 and 1.0.2)
To remove the cache, simply delete the Zip file or folder.
So the only thing that worked for me on my Macbook was removing the package from my composer.json, deleting my composer.lock, running composer update, then adding the package back to composer.json, deleting my composer.lock(again), and running composer update (again). I had a local package in my instance of Laravel Nova that I changed to all lowercase from CamelCase and no matter what I did, it kept adding the package with the old CamelCase name. Didn't matter if I cleared caches or anything.