[SOLVED] Neos Plugin Controller namespace forbidden

Hey guys,

for my neos websites I use a finished site package with a basic configuration. The package is called Default.Site.

Now I wanted to create a controller for a small plugin with the namespace Default\Site\Controller;. Default\... is not “allowed” here.

Is there a solution?

Thx, Pat

Default is a reserved word in PHP so you can’t use it to start a namespace with. The namespace should always start with the vendor (e.g. your name or your company’s name), followed by the package name. Then you should follow the standards to enjoy class loading by composer.

In case of your package, your (assumed) FooController should use the following namespace:

namespace PatricEckhart\DefaultSite\Controller;
class FooController [...]

Your package would then be named PatrickEckhart.DefaultSite and be placed in the Packages/Sites folder, your FooController would therefore reside in ``Packages/Sites/PatrickEckhart.DefaultSite/Classes/PatrickEckhart/DefaultSite/Controller. In your root composer.json you define the path to your classes as follows:

"autoload": {
    "psr-0": {
        "PatrickEckhart\\DefaultSite": "Classes"

After that, execute composer dump-autoload to regenerate the autoloading files.

Thank you Lorenz! I knew “default” (Default≠default? hmm) in PHP is reserved, but I did not think about it when choosing the package name.

Thx, pat