Skip to content

Commit 49a405e

Browse files
update
1 parent c6b80e9 commit 49a405e

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

src/Server.php

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,21 @@ public static function config($key, $default = null, string $base_folder = 'conf
4545

4646
// Laravel: register Application if not already set on the container
4747
if($tame->isLaravel()){
48-
try {
49-
$bootstrap = "{$basePath}/bootstrap/app.php";
50-
require_once $bootstrap;
51-
} catch (\Throwable $th) {
52-
// Ignore continous error
53-
}
48+
self::requireFrameWorkBootstrap("{$basePath}/bootstrap/app.php");
5449
}
50+
// CodeIgniter (assuming CI 3/4)
51+
else if ($tame->isCodeIgniter()) {
52+
self::requireFrameWorkBootstrap("{$basePath}/app/Config/Paths.php");
53+
}
54+
// CakePHP
55+
elseif ($tame->isCakePhp()) {
56+
self::requireFrameWorkBootstrap("{$basePath}/config/bootstrap.php");
57+
}
58+
// Symfony
59+
elseif ($tame->isCakePhp()) {
60+
self::requireFrameWorkBootstrap("{$basePath}/config/bootstrap.php");
61+
self::requireFrameWorkBootstrap("{$basePath}/src/Kernel.php");
62+
}
5563
}
5664
}
5765
} catch (\Throwable $e) {
@@ -244,5 +252,22 @@ private static function isValidJson(mixed $data = null)
244252

245253
return false;
246254
}
255+
256+
/**
257+
* Require framework bootstrap file
258+
*
259+
* @param string $bootstrap
260+
* @return void
261+
*/
262+
private static function requireFrameWorkBootstrap($bootstrap)
263+
{
264+
try {
265+
if (file_exists($bootstrap)) {
266+
require_once $bootstrap;
267+
}
268+
} catch (\Throwable $th) {
269+
// Ignore continuous error
270+
}
271+
}
247272

248273
}

0 commit comments

Comments
 (0)