Easiest way to get current site in php block

Hi, which is the easiest way to get current site and available sites data in php block?
Like in twig you have:

{{ this.site.id }}
{{ this.site.name }}
{{ this.site.code }}
{{ this.site.locale }}
{{ this.site.timezone }}
{{ this.site.theme }}

I’m using the Site Facade, like this:

Site::getSiteFromContext();
Site::listSites():

Isn’t there any $this->....?
Just wanted to check if that was the easiest and more direct way. In twig it seems pretty straight forward.

use System\Classes\SiteManager;
$activeSite = SiteManager::instance()->getSiteFromContext()

1 Like

Hi, thanks, is there any difference from using the Site Facade?

Not really; the Site class is a facade for the SiteManager instance.