How to install CakePHP plugins from Composer into an application / plugin

I am trying to install this plugin: https://github.com/ichikaway/cakephp-mongodb/ to my CakePHP project using Composer. And everything went smoothly, but it was installed in [project root] / Plugin (directory created by Composer, I think) instead of [project root] / app / Plugin.

Obviously in this case it is not possible to load it using:

<?php
//app/Config/bootstrap.php
CakePlugin::load('Mongodb');

      

If I manually move it to the second directory it works fine. But then I have two directories that are terribly misleading. I know from my own experience that ultimately the plugin is supposed to be updated, but in fact there is an older version in the app / plugin that I had to manually copy.

So my question is: How do I install CakePHP plugins from Composer correctly so that they go into the application / plugin?

Thanks for the help!

+3


source to share


1 answer


Add the desired plugin line to /app/composer.json

instead of adding it to /composer.json

.

Minimum content app/composer.json

:



{
    "require": {
        "ichikaway/cakephp-mongodb": "2.2.*@dev"
    }
}

      

Then just run composer update from the console while in your application folder, not your project root folder. This will install it into the Plugin directory relative to your current server position.

+4


source







All Articles