I’m wondering what would be the best way to namespace classes in a plugin. Here are a few suggestions:
- Author\Kirby\Plugin
- Author\Plugin
- Kirby\Plugin\Author\Plugin (verbose, but accurate)
- Kirby\Plugin\Plugin (OK, potential for collisions with plugins by different authors)
- Kirby\Plugin (bad idea)
Bold parts are variable. I sorted them for most favorite to least favorite. The highest ranked was the last to come to mind, but I think it makes most sense. Using Kirby as the starting prefix is probably pretty bad in all 3 cases because it’s not actual source code from Kirby…
If you have a plugin called “foo” it would be best, in my opinion, to use:
- Namespace:
You\Kirby\Foo - GitHub repo:
you/kirby-foo - Composer package:
you/kirby-foo - Registered name in plugin index.php:
you/foo
Opinions?