isDir()) { continue; } $builder->addDefinitions($file->getRealPath()); } } $app = Bridge::create($builder->build()); $folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'middlewares']); if (file_exists($folder)) { $files = new DirectoryIterator($folder); foreach ($files as $file) { if ($file->isDir() or $file->getExtension() != 'php') { continue; } include_once $file->getRealPath(); } } return $app;