shnhndly
shnhndly

Reputation: 106

CKFinder and composer version conflicts

I am working integrating CKFinder (3.1.0) with an existing application. I'd like to use the S3 adapter for storage, which works fine in isolation in the application.

The problem I am having is that the download package for CKFinder 3.1.0 includes its own vendor directory of libraries, including the AWS SDK (v2.27) - I have my own instance of the AWS sdk loaded via composer which is a much more recent version which is conflicting with CKFinder's version, causing errors.

Has anyone had any success is running CKFinder with it's local vendor files alongside project-wide composer libraries such as aws-sdk-php. I can convert to using the 2.27 version of the aws-sdk project wide, but this is not ideal.

Upvotes: 2

Views: 1293

Answers (1)

zaak
zaak

Reputation: 745

CKFinder 3 PHP connector doesn't support installation with Composer yet, but you can modify your composer.json file to make it use application dependencies.

  1. Add following connector dependencies to your composer.json (valid for CKFinder 3.1.0):

    "symfony/http-kernel": ">=2.4,<=2.8-dev",
    "symfony/event-dispatcher": ">=2.4,<=2.8-dev",
    "symfony/http-foundation": ">=2.4,<=2.8-dev",
    "pimple/pimple": "~3.0",
    "monolog/monolog": "~1.4,>=1.4.1",
    "league/flysystem": "1.0.14",
    "league/flysystem-dropbox": "1.0.0",
    "dropbox/dropbox-sdk": "~1.1.1",
    "aws/aws-sdk-php": "~2.7.17",
    "league/flysystem-aws-s3-v2": "1.0.3",
    "league/flysystem-cached-adapter": "1.0.2"
    
  2. Extract connector code from CKFinder package to a separate directory and make it loadable in Composer. Assuming the code will be located in _connector directory:

    • Move the contents from the /ckfinder/core/connector/php/vendor/cksource/ckfinder/src/CKSource/CKFinder directory in the distribution ZIP to _connector.
    • Add it to composer autoloader using a proper namespace:

      "autoload": {
          "psr-4": {
               // ...
               "CKSource\\CKFinder\\": "_connector"
           }
      }
      
    • Alter /ckfinder/core/connector/php/connector.php to use autoload.php from your application.

Important: If you are using AWS-S3 version 3.x SDK in your app, then there's no way to resolve this conflict. CKFinder will not work properly with this version, as AWS-SDK v3 is not backward compatible with v2.7.

Upvotes: 3

Related Questions