These are chat archives for composer/composer

27th
Mar 2017
Srikanth K
@srikanthkolli
Mar 27 2017 06:44
Hi, i am facing issue in composer install. Can someone help?
  preg_match() expects parameter 2 to be string, array given

Exception trace:
 () at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/IO/BaseIO.php:102
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 preg_match() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/IO/BaseIO.php:102
 Composer\IO\BaseIO->loadConfiguration() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Factory.php:307
 Composer\Factory->createComposer() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Factory.php:554
 Composer\Factory::create() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:311
 Composer\Console\Application->getComposer() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:423
 Composer\Console\Application->getPluginCommands() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:132
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:103
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:43
 require() at C:\ProgramData\ComposerSetup\bin\composer.phar:24
MannikJ
@MannikJ
Mar 27 2017 11:20
Hi! How do I tell composer to update a package that is included as a git-repository? After adding the repo to composer.json and running composer install, composer pulled the latest branch state, but I am not able to install/update the changes made to the repository...
Owen Melbourne
@OwenMelbz
Mar 27 2017 12:30
you set it to use dev-master as the version in your main project?
or dev-whateveryourbranchiscalled
MannikJ
@MannikJ
Mar 27 2017 14:05
Yep
Ben Johnson
@cbj4074
Mar 27 2017 14:21
@MannikJ Which Composer commands are you issuing?
Owen Melbourne
@OwenMelbz
Mar 27 2017 14:24
it MIGHT be cached - if you delete the /vendor/your-repo folder, then do composer isntall again, check the commit sha it uses - if its using the old one, try clearing the composer cache
MannikJ
@MannikJ
Mar 27 2017 14:33
@OwenMelbz You are correct! It actually says - Installing vendor/package (dev-master f05e8bb): Loading from cache
Owen Melbourne
@OwenMelbz
Mar 27 2017 14:33
woo, although please dont ask me how to make it skip the cache, as i've no idea haha
MannikJ
@MannikJ
Mar 27 2017 14:41

There is composer clear-cache, but it does not help in my case. It's output is quite weird:

$ composer clear-cache
Clearing cache (cache-dir): /home/profile/.cache/composer
Clearing cache (cache-files-dir): /home/profile/.cache/composer/files
Clearing cache (cache-repo-dir): /home/profile/.cache/composer/repo
Cache directory does not exist (cache-vcs-dir):
All caches cleared.

I am wondering where the cached files are stored if cache-vcs-dir does not exist...

Ben Johnson
@cbj4074
Mar 27 2017 14:43
Probably in the preceding three locations. You shouldn't have to clear the cache manually every time you want to update. That would completely defeat the purpose.
Either you think you're pushing to the remote that Composer is using, but you're not actually doing so, or something else in the workflow is missing.
MannikJ
@MannikJ
Mar 27 2017 14:43
I know ;) But I need to figure out the actual problem.
Ben Johnson
@cbj4074
Mar 27 2017 14:44
I refer back to :point_up: March 27, 2017 10:21 AM
Hard to tell what's happening when we don't know what you're doing.
MannikJ
@MannikJ
Mar 27 2017 15:03

At first I started a laravel project from which a framework emerged which I want to reuse. Next step was to transfer it to the packages folder, create an own git repo and a composer.json file. In the composer file I configured autoload like this:

 "autoload": {
        "psr-4":{
            "Compane\\Package\\": "src/"
        }
    }

In the first laravel project (which contains the framework project) I use it directly via psr-4 import, which works fine. Now I want to use the framework in another project, so I tried to import it via git like

"repositories": [
        {
            "type": "vcs",
            "url": "git@gitlab.com:vendor/package.git",
        }
    ],     "require": {
        "vendor/package": "dev-master"
    },
...

The first executing composer install it loaded the repository, but after that it only used the cashed version

Ben Johnson
@cbj4074
Mar 27 2017 15:11
So you're saying that you're doing composer update vendor/package and it's not being updated?
Please show the output from composer -vvv update vendor/package, then.
MannikJ
@MannikJ
Mar 27 2017 15:27
@cbj4074 Thanks for pointing me to the verbose flag ;) That made solving the problem quite easy. I was pushing to the dev-master branch at the remote repo so composer didn't notice any changes, because there were none on the master branch. Still a bit confusing :D
Owen Melbourne
@OwenMelbz
Mar 27 2017 15:28
@MannikJ you can make it a remote repo - then delete it and symlink to the package, that way its linked to the active branch, maybe make it easier for you
ha, so the branch was just named incorrectly?
MannikJ
@MannikJ
Mar 27 2017 15:28
Yes, I should have pushed to master and not to dev-master
Everything is fine now
Owen Melbourne
@OwenMelbz
Mar 27 2017 15:29
ah right haha, all good then :)
Ben Johnson
@cbj4074
Mar 27 2017 15:30
:thumbsup: Very good. Yeah, that verbosity switch is indispensible when troubleshooting. Glad you have it all working!
MannikJ
@MannikJ
Mar 27 2017 15:31
What is the purpose of the dev-prefix? I don't really get why not have it all congruent
Owen Melbourne
@OwenMelbz
Mar 27 2017 15:31
to show you want to use a branch, rather than a version i guess
MannikJ
@MannikJ
Mar 27 2017 15:32
Yeah, but a version number looks different anyway^^
Or is there a master macro reserved for the latest version ofthe package instead of a version number?