Facades

Overview

Facades serve as "static proxies" to underlying classes in the service container. This provides flexibility over traditional static methods with the benefit of terser syntax.

Use

In the context of a hub, a facade is a class that provides access to an object from the container. For this to work, all facades extend the base Hubzero\Facades\Facade class.

A facade class only needs to implement a single method: getAccessor, which defines what to resolve from the container. The base Facade class makes use of the __callStatic() magic-method to defer calls from the facade to the resolved object.

Below is the facade for the Filesystem wherein the getAccessor() method returns the string 'filesystem', which is the key that the Filesystem service is registered with on the application.

This facade serves as a proxy to accessing the underlying implementation of the Hubzero\Filesystem\Filesystem interface. So, when any static method on the facade is referenced, the application resolves the binding from the service container and runs the requested method against that object. In short, any calls made using the facade will be passed to the underlying instance of the filesystem service.

Class Reference

Below is a list of every facade, its underlying class, and the service container binding key where applicable.