It may be interesting for you to use https://github.com/BinaryKitten/ZeffMu/blob/v0.0.1/src/ZeffMu/App.php#L59-L80 here