code: private function setSlimMiddleware(\Slim\App $slim, $slimContainer)
      {
          /** handle CSRF check failures and allow template to access and insert CSRF fields to forms */
          $slim->add(new CsrfMiddleware($slimContainer));
  
          /** Insert System Event for every resource request */
          if (isset($this->config['trackAll']) && $this->config['trackAll']) {
              $slim->add(new TrackerMiddleware($slimContainer));
          }
  
          /** slim CSRF check middleware */
          $slim->add($slimContainer->csrf);
      }
docs: Global middleware registration