Use a factory class - closures in config are absolutely prohibited since they make caching of config impossible