title: TYPO3 9.2.1 Create ViewHelper in Composer Mode
body: <p>I'm trying to create a ViewHelper with a TYPO3 which was installed in composer mode and a site package which was generated with the <a href="https://sitepackagebuilder.com" rel="nofollow noreferrer">sitepackagebuilder</a>.</p>
  
  <p>The autoloading should be configured correctly, nevertheless the only thing I'm getting is an error message, that the ViewHelper cannot be found:</p>
  
  <pre><code>#1407060572: Fluid parse error in template Standard_action_Default_9cc8c1fca58b49310db5d43052e614cefdb1c728, line 5 at character 6. Error: The ViewHelper "&lt;foobar:some&gt;" could not be resolved. Based on your spelling, the system would load the class "Foo\Bar\ViewHelpers\SomeViewHelper", however this class does not exist. (error code 1407060572). Template source chunk: &lt;foobar:some /&gt; (More information)
  
  TYPO3Fluid\Fluid\Core\Parser\Exception thrown in file
  /var/www/html/vendor/typo3fluid/fluid/src/Core/Parser/TemplateParser.php in line 157.
  </code></pre>
  
  <h2>Steps To Reproduce</h2>
  
  <ol>
  <li>install TYPO3 in composer mode (newest version 9.2.1)</li>
  <li>create a site package with <a href="https://sitepackagebuilder.com" rel="nofollow noreferrer">https://sitepackagebuilder.com</a> - simple configuration, 'foo' as company name and 'bar' as extension key (see screenshot below)</li>
  <li>create a simple class <code>SomeViewHelper</code> under <code>Classes/ViewHelpers/</code></li>
  <li><p>modify the template under <code>Page/Default</code> to contain the <code>SomeViewHelper</code> (following the example from <a href="https://docs.typo3.org/typo3cms/ExtbaseFluidBook/8-Fluid/8-developing-a-custom-viewhelper.html" rel="nofollow noreferrer">docs.typo3.org</a>)</p>
  
  <p><code>{namespace foobar=Foo\Bar\ViewHelpers}
  &lt;foobar:some /&gt;</code></p></li>
  <li><p>create a new root page in TYPO3 with simple content and include the <code>bar</code> extension (Template > Includes)</p></li>
  </ol>
  
  <p>The autoloading of the code should be handled by the <code>composer.json</code>/<code>ext_emconf.php</code> files which are generated by the sitepackagebuilder.</p>
  
  <h3>Screenshot</h3>
  
  <p><a href="https://i.stack.imgur.com/EhsI4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EhsI4.png" alt="site package builder configuration"></a></p>
  
  <h2>Code</h2>
  
  <h3>SomeViewHelper.php</h3>
  
  <pre><code>&lt;?php
  namespace Foo\Bar\ViewHelpers;
  
  
  use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
  
  class SomeViewHelper extends AbstractViewHelper
  {
      public function render() {
          return 'Hello World';
      }
  }
  </code></pre>
  
  <h3>Page/Default.html</h3>
  
  <pre><code>&lt;f:layout name="Default" /&gt;
  &lt;f:section name="Main"&gt;
  
      {namespace foobar=Foo\Bar\ViewHelpers}
      &lt;foobar:some /&gt;
  
      &lt;f:cObject typoscriptObjectPath="lib.dynamicContent" data="{colPos: '0'}" /&gt;
  
  &lt;/f:section&gt;
  </code></pre>
  
  <p>also declaring the namespace at the top of the document did not help</p>
  
  <pre><code>&lt;html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
        xmlns:foobar="http://typo3.org/ns/Foo/Bar/ViewHelpers"&gt;
  &lt;f:layout name="Default" /&gt;
  &lt;f:section name="Main"&gt;
  
      &lt;foobar:some /&gt;
  
      &lt;f:cObject typoscriptObjectPath="lib.dynamicContent" data="{colPos: '0'}" /&gt;
  
  &lt;/f:section&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h3>composer.json</h3>
  
  <pre><code>{
      "name": "foo/bar",
      "type": "typo3-cms-extension",
      "description": "",
      "homepage": "https://www.foo.com",
      "license": ["GPL-2.0-or-later"],
      "keywords": ["TYPO3 CMS"],
      "version": "1.0.0",
      "require": {
          "typo3/cms-core": "^8.7 || ^9.0",
          "typo3/cms-rte-ckeditor": "^8.7 || ^9.0",
          "typo3/cms-fluid-styled-content": "^8.7 || ^9.0"
      },
      "autoload": {
          "psr-4": {
              "Foo\\Bar\\": "Classes/"
          }
      }
  }
  </code></pre>
  
  <h3>ext_emconf.php</h3>
  
  <pre><code>&lt;?php
  
  /**
   * Extension Manager/Repository config file for ext "bar".
   */
  $EM_CONF[$_EXTKEY] = [
      'title' =&gt; 'Bar',
      'description' =&gt; '',
      'category' =&gt; 'templates',
      'constraints' =&gt; [
          'depends' =&gt; [
              'typo3' =&gt; '8.7.0-9.5.99',
              'fluid_styled_content' =&gt; '8.7.0-9.5.99',
              'rte_ckeditor' =&gt; '8.7.0-9.5.99'
          ],
          'conflicts' =&gt; [
          ],
      ],
      'autoload' =&gt; [
          'psr-4' =&gt; [
              'Foo\\Bar\\' =&gt; 'Classes'
          ],
      ],
      'state' =&gt; 'stable',
      'uploadfolder' =&gt; 0,
      'createDirs' =&gt; '',
      'clearCacheOnLoad' =&gt; 1,
      'author' =&gt; 'John Doe',
      'author_email' =&gt; 'jd@foo.com',
      'author_company' =&gt; 'foo',
      'version' =&gt; '1.0.0',
  ];
  </code></pre>