Tassja Tissot
Tassja Tissot

Reputation: 21

Own TYPO3 Extension with composer: Could not analyse class maybe not loaded or no autoloader?

I just wrote my first TYPO3 Extension, but it doesn't work :( I got this error message at my TYPO3 Frontend:

Could not analyse class: "Snowboard\SnowboardStaff\Controller\SnowboardTeacherController" maybe not loaded or no autoloader? Class Snowboard\SnowboardStaff\Controller\SnowboardTeacherController does not exist

I installed TYPO3 with composer. So may be this problem have something to do with this?

I already tried al lot, so please help me :)

Upvotes: 2

Views: 834

Answers (2)

bschauer
bschauer

Reputation: 1008

If you installed your extension with composer you can place the autoload in the extension's composer.json file like "Thomas" already wrote. But if you just put your extension into the typo3cond/ext folder you must add the autoload settings in the main composer.json file in your root directory.

composer.json in the extension:

"autoload": {
   "psr-4": {
      "Vendor\\Yourext\\": "Classes/"
   }
},

composer.json in root:

"autoload": {
   "psr-4": {
      "Vendor\\Yourext\\": "web/typo3conf/ext/startpilot/Classes"
   }
 },

Upvotes: 6

Thomas Löffler
Thomas Löffler

Reputation: 6164

You have to add the location of your classes into your extension's composer.json:

"autoload": {
  "psr-4": {
    "Snowboard\\SnowboardStaff\\": "Classes/",
  }
}

Upvotes: 1

Related Questions