isDir()) { continue; } $builder->addDefinitions($file->getRealPath()); } } $app = Bridge::create($builder->build()); $folder = implode(DIRECTORY_SEPARATOR, [ __DIR__, 'middleware' ]); if (file_exists($folder)) { $files = new FilesystemIterator($folder); foreach ($files as $file) { if ($file->isDir()) { continue; } require_once $file->getRealPath(); } } return $app;