Do something early during bootstrap phase - i.e. integrating


I want to integrate in my Flow app. Rollbar is simple service for reporting errors/exceptions from your app, so it makes sense to initialise it as early as possible.

Basically I need to call the following line with $config from Settings.yaml (as explained here:


I tried doing that from Package::boot(), but configuration from @Flow\InjectConfiguration() annotation is not injected at this stage yet.

Any pointers what’s the best approach to achieve that?
Is hooking to finishedCompiletimeRun slot best way to do that (as injecting settings at this stage already works)?

You would listen to the boot signals and wait for the configuration manager to be booted, then do this.

This should probably be:
Initialize it as early as needed but as late as possible :slight_smile:
I.e. if there’s nothing to log to Rollbar during a request, why initialize it`?

Instead of initializing it via Signal/Slot in your Package.php you could instead just rename the method to initializeObject() and flow will automatically invoke it as soon as you access that object.

Thanks guys.

I used Dispatcher::beforeControllerInvocation slot at the end (you can see it here:

Bastian’s point is absolutely valid… I didn’t know about initializeObject() and I could improve the implementation with that. In the next iteration… :slight_smile: