Search code examples
composer-phptypo3typo3-extensions

composer installs own TYPO3 extension in wrong path


I have a own TYPO3 extension hosted on bitbucket. Getting this via composer works (see here for input). The extension is downloaded into my vendor folder. Being there i cannot install the extension via extension-manager.

How can I getting my ext into typo3conf/ext (ensuring autoloading will work)?

The extensions coming via

{
"type": "composer",
"url": "http://composer.typo3.org/"
}

are going to (as expected):

web/typo3config/ext 

here is my project composer.json:

{
  "repositories": [
        {
            "type": "composer",
            "url": "http://composer.typo3.org/"
        },
        {
            "type": "package",
            "package": {
                "name": "metaxos/exaibbrplus",
                "version": "dev-2016",
                "source": {
                    "url": "https://[email protected]/metaxos/exaibbrplus.git",
                    "type": "git",
                    "reference": "release/2016"
                }
            }
        }
    ],
  "name": "Metaxos/ibbrating2016",
  "require": {
    "typo3/cms": "7.6.2",
    "bk2k/bootstrap-package" : "dev-master",
    "typo3-ter/compatibility6" : "7.6.0",
    "typo3-ter/extension-builder" : "7.6.0",
    "metaxos/exaibbrplus": "dev-2016"
  },
  "extra": {
    "typo3/cms": {
      "cms-package-dir": "{$vendor-dir}/typo3/cms",
      "web-dir": "web"
    }
  }
} 

here is my extension composer.json:

{
  "name": "metaxos/exaibbrplus",
  "description": "custom ext for typo3",
  "type": "typo3-cms-extension",
  "version": "0.0.1",
  "require": {
    "typo3/cms-core": ">=7.6.0,<8.0"
  },
  "replace": {
    "extkey": "self.version",
    "typo3-ter/extkey": "self.version"
  },
  "autoload": {
    "psr-4": {
      "Metaxos\\Exaibbrplus\\": "Classes/"
    }
  },
  "keywords": ["custom", "ext"],
  "homepage": "http://www.blah.ch"
}

Solution

  • You need to add the type key with the value typo3-cms-extension to the root composer.json. This will place your extension in web/typo3conf/ext instead of vendor/$vendor/$package which in turn will make it available to the cms.

    It is important, to know that if you redefine the package in the root composer.json as repository type package, nothing from the extensions' composer.json file will be taken into account and you need to define any concerns about that package in the root composer.json.

    So-applying the rules I mentioned above, your root composer.json will look like that:

    { "repositories": [ { "type": "composer", "url": "http://composer.typo3.org/" }, { "type": "package", "package": { "name": "metaxos/exaibbrplus", "version": "dev-2016", "type": "typo3-cms-extension", "source": { "url": "https://[email protected]/metaxos/exaibbrplus.git", "type": "git", "reference": "release/2016" }, "autoload": { "psr-4": { "Metaxos\\Exaibbrplus\\": "Classes/" } }, } } ], "name": "Metaxos/ibbrating2016", "require": { "typo3/cms": "7.6.2", "bk2k/bootstrap-package" : "dev-master", "typo3-ter/compatibility6" : "7.6.0", "typo3-ter/extension-builder" : "7.6.0", "metaxos/exaibbrplus": "dev-2016" }, "extra": { "typo3/cms": { "cms-package-dir": "{$vendor-dir}/typo3/cms", "web-dir": "web" } } }

    As mentioned above by @helmbert, you are either left with completely redefining the package or using another repository type. You may want to consider using satis or a URL repository.