How to retrieve Site Url and Site Name in Plugin I'm having an exceedingly difficult time trying to retrieve the Site URL and Name in a custom plugin I am developing.

My research has led me to believe this would work:

$envVar = craft()-&gt;config-&gt;get('environmentVariables');
$siteUrl = $envVar['siteUrl'];
$siteName = $envVar['siteName'];


But in practice this hasn't worked. Does anyone know the correct way?
In Craft 3 you can do this:
use craft\helpers\UrlHelper;
UrlHelper::siteUrl();

Craft::$app-&gt;sites-&gt;currentSite-&gt;name;