@mooseh I don’t think you quite understand façades. You make a service, and then can create a façade to reference that service; you don’t create the façade first and put the methods in there.
You should:
- Create a class.
- Register it in the service container.
- Create a façade that points to the key in the service container.
You can then use your façade, or the key in the container, to retrieve your class.
As for method chaining, in each method you just need to simple return $this, i.e.
class SomeClass
{
public function someMethod()
{
// Do something
return $this;
}
public function anotherMethod()
{
// Do something else
return $this;
}
public function yetAnotherMethod()
{
}
}
You can then use the methods in chaining:
$instance = new SomeClass;
$instance->someMethod()->anotherMethod()->yetAnotherMethod();
Or via a façade:
SomeFacade::someMethod()->anotherMethod()->yetAnotherMethod();