On this page you find information about the implemented php standards recommendations in Nextcloud.

PSR-0: Autoloading

This standard has been deprecated and will be removed from Nextcloud. Please see the PSR-4 section instead.

PSR-3: Logger Interface

As of Nextcloud 19, the dependency injection container can inject an instance of a \Psr\Log\LoggerInterface. This is merely a wrapper of the existing (and strongly typed) \OCP\ILogger. Apps may still use the Nextcloud logger, but the PSR-3 implementation shall easy the integration of 3rd party libraries that require the PSR-3 logger.

PSR-4: Autoloading

The PSR-4 standard describes how class files should be named, so Nextcloud can automatically load them. See the classloader docs for details.

PSR-11: Container Interface

As of Nextcloud 20, the dependency injection container follows the PSR-11 container interface, so you may start type-hinting \Psr\Container\ContainerInterface whenever you want an instance of a container and use has($id) to check for existance and get($id) to retrieve an instance of a service. See the dependency injection docs for details.