3

Drupal 8 now uses the PSR-4 specification for namespaces and auto-loading; module developers need to keep their PHP classes in their module's src directory.
However, if you look in the core directory, Drupal keeps all these in the lib directory.

Why is this so?

  • 1
    I was wandering that myself. My guess was that it is a leftover from the psr-1 days. – Eyal Jun 10 '16 at 18:39
1

The following document explains the differences between PSR-4 and PSR-0, and the reason why PSR-4 was suggested.

It also explains that PSR-4 complies with the PSR-0.

Basically, when working with packages (modules) PSR-4 is preferable. But the base package can still use PSR-0 and be readable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.