From 6a10ab2ca632c65e071ed2fbef7476a60d7c205f Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Wed, 8 Jun 2022 21:55:26 +0200 Subject: [PATCH 1/3] (hydephp/realtime-compiler:v2.1.x) Handle new bootstrapping file --- .../src/Concerns/InteractsWithLaravel.php | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/realtime-compiler/src/Concerns/InteractsWithLaravel.php b/packages/realtime-compiler/src/Concerns/InteractsWithLaravel.php index e77a44be23a..e047e2a1784 100644 --- a/packages/realtime-compiler/src/Concerns/InteractsWithLaravel.php +++ b/packages/realtime-compiler/src/Concerns/InteractsWithLaravel.php @@ -16,7 +16,25 @@ trait InteractsWithLaravel protected function createApplication(): void { - $this->laravel = require_once sprintf('%s/bootstrap/app.php', BASE_PATH); + // The core bootstrapping file was moved in hyde/framework v0.35.x. + // To preserve backwards compatibility, we will continue to load + // the old bootstrap file for several minor versions. + + $legacyBootstrapper = sprintf('%s/bootstrap/app.php', BASE_PATH); + $bootstrapper = sprintf('%s/app/bootstrap.php', BASE_PATH); + if (file_exists($legacyBootstrapper) && !file_exists($bootstrapper)) { + trigger_error( + sprintf( + 'The "%s" file is deprecated since hyde/framework:v0.35.x Please use "%s" instead.', + $legacyBootstrapper, + $bootstrapper + ), + E_USER_DEPRECATED + ); + $bootstrapper = $legacyBootstrapper; + } + + $this->laravel = require_once $bootstrapper; } protected function bootApplication(): void From 2e9bdc120c220e2480c5d15b88a9de33db6e81c6 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Wed, 8 Jun 2022 21:59:52 +0200 Subject: [PATCH 2/3] Add back bootstrap/app.php for backwards compatibility --- bootstrap/app.php | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 bootstrap/app.php diff --git a/bootstrap/app.php b/bootstrap/app.php new file mode 100644 index 00000000000..0fd234e1ade --- /dev/null +++ b/bootstrap/app.php @@ -0,0 +1,61 @@ +singleton( + Illuminate\Contracts\Console\Kernel::class, + LaravelZero\Framework\Kernel::class +); + +$app->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + Illuminate\Foundation\Exceptions\Handler::class +); + +/* +|-------------------------------------------------------------------------- +| Set Important Hyde Configurations +|-------------------------------------------------------------------------- +| +| Next, we need to configure Hyde to to use our project's base path. +| +*/ + +\Hyde\Framework\Hyde::setBasePath(getcwd()); + +/* +|-------------------------------------------------------------------------- +| Return The Application +|-------------------------------------------------------------------------- +| +| This script returns the application instance. The instance is given to +| the calling script so we can separate the building of the instances +| from the actual running of the application and sending responses. +| +*/ + +return $app; From e68a1fa5c98003a60a8148bee98e76ecb678eff6 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Wed, 8 Jun 2022 22:01:33 +0200 Subject: [PATCH 3/3] Add deprecation notice --- bootstrap/README.md | 5 +++++ bootstrap/app.php | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 bootstrap/README.md diff --git a/bootstrap/README.md b/bootstrap/README.md new file mode 100644 index 00000000000..7e443f68ee7 --- /dev/null +++ b/bootstrap/README.md @@ -0,0 +1,5 @@ +# Deprecation Notice + +This file (bootstrap/app.php) is deprecated as of v0.35.x as it has been moved to app/bootstrap.php. + +The file is preserved for backwards compatibility. \ No newline at end of file diff --git a/bootstrap/app.php b/bootstrap/app.php index 0fd234e1ade..d860bd58c2f 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,5 +1,10 @@