How do I get the siteName in a module (Craft 3) In templates I can do something like {{siteName}}. But how do I retrieve this in a module?
I've tried:
Craft::$app-&gt;config-&gt;siteName
I can grab my custom globals via Craft::$app-&gt;globals, but the class reference doesn't say anything about the defaults like siteName
When searching the Craft 3.5.x docs for siteName, I see references to Global Variables and General Config Settings. Screenshot: https://cln.sh/egvIXhxZSzaFjeCgNLxX
However, AFAICT, it works differently for modules/plugins. As per the Sites section in the Craft 3.5.x Class Reference docs at https://docs.craftcms.com/api/v3/craft-services-sites.html, you would do something like one of the following:
Craft::$app-&gt;sites-&gt;currentSite-&gt;name;
Craft::$app-&gt;sites-&gt;primarySite-&gt;name;
Craft::$app-&gt;sites-&gt;getSiteByHandle('default')-&gt;name;
Craft::$app-&gt;sites-&gt;getSiteById(1)-&gt;name;

I'm getting the name part because I'm using PhpStorm with autocomplete set up as per article at https://nystudio107.com/blog/auto-complete-craft-cms-3-apis-in-twig-with-phpstorm
Screenshot of autocomplete in action: https://cln.sh/T77W1Y69SmR3qPUPv0sb
I'm successfully using Craft::$app-&gt;sites-&gt;getSiteById(1)-&gt;name; in one of my custom modules.