Proposal for fixing PHP namespacing in Drupal 8 | Blog post | Blue Droplet Media

By rprice , 29 February 2012
Modules and themes (and engines) would have a namespace such as namespace drupal\taxonomy; or namespace drupal\bartik; Function prefixes, such as 'taxonomy_' would be dropped. However, this makes Drupal code really ugly. Calling functions not in a module from a module would look like this: \drupal\set_message(); Calling a db function would look like this: \drupaldb\select('node'); Calling an API function in another module would look like: \drupal\taxonomy\select_nodes(); The solution? Namespace importing. Every PHP file in a module would need to declare which namespaces it needs to access, e.g.