Run $this->listen array to listen events.
Execute function in boot() method of ServiceProvider

@return void
327930
protected function listen()
    {
        $events = app('events');
        if (isset($this->listen)) {
            foreach ($this->listen as $event => $listeners) {
                foreach ($listeners as $listener) {
                    $events->listen($event, $listener);
                }
            }
        }
        
        if (isset($this->subscribe)) {
            foreach ($this->subscribe as $subscriber) {
                $events->subscribe($subscriber);
            }
        }
    }
1254227
public function boot()
    {
        if ($this->app->runningInConsole()) {
            $this->publishes([
                __DIR__.'/../config/service-classes.php' => config_path('service-classes.php'),
            ]);
        }

        $this->mergeConfigFrom(__DIR__.'/../config/service-classes.php', 'service-classes');

        $this->commands([
            ServiceMakeCommand::class,
            CachedServiceMakeCommand::class,
        ]);

        ServiceCaller::setHandlerMethod(config('service-classes.method', 'run'));
    }
621585
public static function run()
    {
        self::init();

        /*
         * Register routes.
         */
        call_user_func(function () {
            /** @noinspection PhpIncludeInspection */
            require self::$basePath . '/boot/routes.php';
            if (file_exists(self::$basePath . '/.manifest/plugins/routes.php')) {
                /** @noinspection PhpIncludeInspection */
                include self::$basePath . '/.manifest/plugins/routes.php';
            }
        });

        /*
         * Dispatch the HTTP request and send the response to the browser.
         */
        /** @var \Core\Services\Contracts\Router $router */
        $router   = DI::getInstance()->get('router');
        $request  = DI::getInstance()->get('request');
        $response = $router->dispatch($request);
        $response->send();
    }
1312165
protected static function boot()
    {
        parent::boot();

        Event::listen(TranslationHasBeenSet::class, function (TranslationHasBeenSet $event) {
            $event->model->updateCustomProperty($event->key, $event->newValue);
            unset($event->model->attributes[$event->key]);
        });
    }
1094126
public function boot()
	{
		if ($this->booted)
		{
			return;
		}

		array_walk($this->serviceProviders, function($p)
		{
			$this->bootProvider($p);
		});

		$this->booted = true;
	}
922251
protected function listen()
    {
        $this->eventEmitter->on('peridot.concurrency.load', [$this, 'setPending']);
        $this->eventEmitter->on('peridot.concurrency.worker.run', [$this, 'addRunning']);
        $this->eventEmitter->on('peridot.concurrency.worker.completed', [$this, 'onWorkerComplete']);
        $this->broker->on('end', [$this, 'onMessageEnd']);
        $this->broker->on('error', [$this, 'onError']);
        $this->broker->on('suite.halt', [$this, 'stop']);
    }
1023749
public function boot()
    {
        parent::boot();

        if (Schema::hasTable(Config::get('amethyst.listener.data.listener.table'))) {
            $lm = new ListenerManager();

            $available = $lm->getAvailableEventClasses();

            Event::listen(Config::get('amethyst.listener.events'), function ($event_name, $events) use ($available) {
                if (!in_array($event_name, $available, true)) {
                    return true;
                }

                $lm = new ListenerManager();
                $wm = new WorkManager();
                $tm = new TemplateManager();

                /** @var \Railken\Amethyst\Repositories\ListenerRepository */
                $repository = $lm->getRepository();

                $listeners = $repository->findByEventClass($event_name);

                foreach ($listeners as $listener) {
                    foreach ($events as $event) {
                        $condition = $tm->renderRaw('text/plain', $listener->condition, ['event' => $event]);

                        $data = (array) Yaml::parse($tm->renderRaw('text/plain', $listener->data, ['event' => $event]));

                        if ($condition === '1') {
                            $wm->dispatch($listener->work, $data);
                        }
                    }
                }

                return false;
            });
        }
    }
1188397
public function boot()
    {
        if ($this->booted) {
            return;
        }

        \array_walk($this->loadedProviders, function ($p) {
            $this->bootProvider($p);
        });

        // Once the application has booted we will also fire some "booted" callbacks
        // for any listeners that need to do work after this initial booting gets
        // finished. This is useful when ordering the boot-up processes we run.
        $this->fireAppCallbacks($this->bootingCallbacks);

        $this->booted = true;

        $this->fireAppCallbacks($this->bootedCallbacks);
    }
768797
public function notifyListeners() {

        foreach ($this->listeners as $listener) {

            $listenerClass = $listener['listener'];
            $handler = array($listenerClass, 'on_' . $this->state);
            if(!class_exists($listenerClass)) {
                throw new \Exception($listenerClass . ' does not exist');
            }

            if ($this->state == $listener['event'] && is_callable($handler)) {
                unset($listener['listener']);     
                
                $eventListener = new $listenerClass($this->logger, $this->request, $this->response);
                $eventListener->setDatasources($this->datasourceFactory, $this->datasources);
                $eventListener->setDatasourceKey($this->datasourceKey);
                $eventListener->setEventDispatcher($this->eventDispatcher);
                $eventListener->setConfig($listener);
                $eventListener->setCacheManager($this->cacheManager);
                $eventListener->setContainer($this->container);

                $eventListener->execute($this->state, $this->event);

            }
        }
      
     
    }
242884
public function boot()
    {
        $app = $this->app;

        // Listen to log messages.
        $app['log']->listen(function ($level, $message, $context) use ($app) {
            $app['rollbar.handler']->log($level, $message, $context);
        });
    }
1000684
public function run(): void
    {
        // dynamicly parse input params
        $args = func_get_args();
        
        if (count($args) < 1) {
            return;
        }
        
        // get event name
        $eventName = array_shift($args);
        // get event args as array if passed
        $eventArgs = @array_shift($args);

        // if event is registered
        if (isset($this->events[$eventName]) && Any::isArray($this->events[$eventName])) {
            foreach ($this->events[$eventName] as $callback) {
                // call anonymous function with args if passed
                call_user_func_array($callback, $eventArgs);
            }
        }
        
        // set to post runned actions
        $this->runned[$eventName] = $eventArgs;
    }
1313177
public function run()
	{
		$context = $this->getContext();
		$serviceManager = \Aimeos\MShop::create( $context, 'service' );

		$search = $serviceManager->createSearch();
		$start = 0;

		do
		{
			$serviceItems = $serviceManager->searchItems( $search );

			foreach( $serviceItems as $serviceItem )
			{
				try
				{
					$serviceManager->getProvider( $serviceItem, $serviceItem->getType() )->updateAsync();
				}
				catch( \Exception $e )
				{
					$msg = 'Executing updateAsyc() of "%1$s" failed: %2$s';
					$context->getLogger()->log( sprintf( $msg, $serviceItem->getProvider(), $e->getMessage() ) );
				}
			}

			$count = count( $serviceItems );
			$start += $count;
			$search->setSlice( $start );
		}
		while( $count >= $search->getSliceSize() );
	}
1058483
protected function watch()
    {
        $this->showProgress('BOOT: booting watchers...');

        if (is_null($this->loader->watchFolders)) {
            $this->showProgress('No watch folders found.', 'error');

            return;
        }

        foreach ($this->loader->watchFolders as $folder) {
            if (!file_exists($folder)) {
                $this->showProgress("ERROR: folder {$folder} does not exists", 'error');

                continue;
            }

            $this->showProgress('WATCHING '.$folder);

            $this->listeners[$folder] = $this->watcher->watch($folder);

            $this->listeners[$folder]->anything(function ($event, $resource, $path) {
                if (!$this->isExcluded($path)) {
                    $this->fireEvent($event, $resource, $path);
                }
            });
        }

        $this->watchConfigFile();

        $this->watcher->start();
    }
929194
protected function listenForEvents()
    {
        $events = $this->container['events'];

        $events->listen('nova.queue.processing', function ($connection, $job)
        {
            $this->writeOutput($job, 'starting');
        });

        $events->listen('nova.queue.processed', function ($connection, $job)
        {
            $this->writeOutput($job, 'success');
        });

        $events->listen('nova.queue.failed', function ($connection, $job)
        {
            $this->writeOutput($job, 'failed');
        });
    }
947269
protected function callConfiguratorsOnce()
    {
        if ($this->configuratorsCalled) {
            return;
        }

        foreach (static::$configurators as $listener) {
            call_user_func($listener, $this, $this->container);
        }

        $this->configuratorsCalled = true;
    }
516938
public function boot()
  {
    if ($this->booted) return;
    
    $this->container = $container = new Container();
    
    $this->registerServices      ($container);
    $this->registerRoutes        ($container);
    $this->registerEventListeners($container);
    
    $this->booted = true;
  }
947643
public function boot()
    {
        if ($this->booted) return;

        // Register service providers
        foreach ($this['config']->get('app.providers') as $provider) {
            $this->addProvider($provider);
        }

        // Register aliases
        AliasLoader::getInstance($this['config']->get('app.aliases'))->register();

        // Now run boot events on service providers
        array_walk($this->registered, function($p) {
            if (method_exists($p, 'boot')) $p->boot();
        });

        if (file_exists($bootstrap = $this->appPath."/bootstrap/{$this->mode}.php")) {
            require $bootstrap;
        }

        $this->booted = true;
    }