I am looking for ways to trigger an event in my local dev to check out a custom event subscriber. The actual event is triggered by Google social auth and I don't think it is possible to do that locally.
Is it possible to trigger events using devel
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
You can use the
event_dispatcher service to trigger an event.
Use this code to trigger your event.
\Drupal::service('event_dispatcher')->dispatch(MyModuleEvents::MY_EVENT, new MyModuleEventClass());
Of course you have to replace the names with your real names.
You can run the code using
You can read more about subscribing and dispatching events here.