Hello app devs,
Here’s a heads-up for the maintainers of apps that still use class file names following the deprecated PSR-0 standard.
What will change?
Until Nextcloud 26 PSR-0 files will still be loaded by default. With 27 apps have to finally upgrade to PSR-4 or ship their own class loader. We highly recommend PSR-4 for better performance.
How do I adjust my app?
If you have a class \OCA\MyApp\FooBar
at myapp/foobar.php
then rename and move the file to lib/FooBar
. The file name must match the class name. The namespace after \OCA\MyApp
must match the directory structure inside lib
.
Another famous example is myapp/appinfo/application.php
. That file should be migrated to lib/AppInfo/Application.php
.
Resources
Ref https://docs.nextcloud.com/server/latest/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_26.html#planned-removal-of-psr-0-class-loading
Ref PSR-4: Autoloader - PHP-FIG
Ref perf(autoloader): Drop legacy class autoloader by ChristophWurst · Pull Request #36114 · nextcloud/server · GitHub