Ordnerstruktur und PSR-4 Autoloading Standard
Hallo zusammen,
mir ist im Contao Manager, als ich etwas an einer Erweiterung einer bestehenden Installation aktualisiert habe, aufgefallen, dass folgende Hinweise in der Konsole des Managers ausgegeben werden:
Code:
Deprecation Notice: Class ... located in ./src/NameBundle/Resources/contao/dca/... does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0.
Meine Erweiterung lade ich in der composer.json über folgenden Eintrag:
Code:
"autoload": {
"psr-4": {
"": "src/"
}
}
Meine Ordnerstruktur sieht aktuell so aus:
Code:
Wurzelverzeichnis
app
assets
contao-manager
files
src
NameBundle
ContentElement
...
Resources
contao
classes
config
dca
forms
languages
models
templates
public
...
ContaoManagerPlugin.php
system
templates
var
vendor
web
Mir ist nun jedoch in den Docs dieser Artikel aufgefallen.
Hier scheint eine Erweiterung nicht in einem eigenen Verzeichnis "src" im Wurzelverzeichnis, sondern im "app" Verzeichnis hinzugefügt zu werden?
Daher nun meine Fragen:
Wie genau konfiguriere ich meine Erweiterung als PSR-4 konform?
Wie sollte oder müsste ich die Ordnerstruktur meiner Erweiterung verändern, damit auch hier alles in Ordnung ist?
Liste der Anhänge anzeigen (Anzahl: 2)
Hei,
meine Extensions sind jetzt auch mit Depreceated-Meldungen beglückt worden. Also dachte ich, ich hangele mich am https://github.com/contao/skeleton-bundle lang. Aber leider gibt es da kein app Verzeichnis. Leider konnte ich auch keine Extension finden, die psr-4 mit dem app Verzeichnis schon umgesetzt hat.
Abschließend habe ich ich versucht, den Vorschlägen von https://docs.contao.org/dev/getting-...g-development/ zu folgen. Gestartet bin ich mit: Anhang 23884. Das Ergebnis sieht dann wie folgt aus: Anhang 23883
Ist das Richtig so?
Oder kennt jemand eine Extension, die schon psr-4 kompatibel ist und keine Depreceated-Meldung ausgibt an die man "kopieren" kann?
P.S. Der Vollständigkeit halber....
Code:
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotAHBL located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\AHBL.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotBlocklist located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\Blocklist.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotBotScout located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\BotScout.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotFSpamList located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\FSpamList.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotHoneypot located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\Honeypot.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotIntern located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\Intern.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotIPStack located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\IPStack.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotNixSpam located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\NixSpam.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotSORBS located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\SORBS.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotSpamCop located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\SpamCop.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotSpamhaus located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\Spamhaus.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotStopForumSpam located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\StopForumSpam.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotUCEProtect1 located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\UCEProtect1.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotUCEProtect2 located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\UCEProtect2.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotUCEProtect3 located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\UCEProtect3.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotWPBL located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Module\engines\WPBL.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class syncgw\SpamBotBundle\Module\SpamBotCall located in C:/aXa/Docs/www/tst/vendor/syncgw/contao-spambot/src\Resources\public\SpamBotCall.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/aXa/Docs/www/tst/web/contao-manager.phar.php/vendor/composer/composer/src/Composer/Autoload/ClassMapGenerator.php:201