简体   繁体   中英

Conflict between Composer autoload and EzPublish one

First sorry for my bad English, I'm a French speaker ^^. I'm working with Restler as webservice in my eZpublish framework.

When I have installed Restler, I have installed Composer too.

In the index file in witch I use Restler methods, and API classes, I include both ezpublish autoload en restler one, but i have a conflict. When I remove the ezpublish autoload, API classes are not recognized. I want to know how I can, in the composer.json, add all classes of my application.

in the Composer.json file, i have

 "autoload":{
        "psr-0":{
            "Luracast\\Restler": "vendor/"
        }

` I want to change vendor/ by extension/ because all classes are in extension, Restler classes too. I just want to have all classes with one namespace. Could you help me please. Thanks in advance.

Assuming that you are using eZ Publish Legacy (4.x), you don't need to add the autoload settings for restler in your root composer.json, just add it as a requirement and let composer handle the rest:

{
    "require": {
        "luracast/restler": "~3.0"
    }
}

In your index.php you should then be able to use

include __DIR__ . '/vendor/autoload.php';

in addition to the eZ Publish autoloads.

For your custom classes inside your extension, you have to execute

php bin/php/ezpgenerateautoloads.php -e

so that they will be found by the eZ Publish autoloader.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM