Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle moving of the bootstrap file to provide backwards compatibility for the migration period #17

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bootstrap/README.md
Original file line number Diff line number Diff line change
@@ -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.
66 changes: 66 additions & 0 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

/**
* @deprecated v0.35.x-dev - This file has moved to app/bootstrap.php,
* and will be removed in a future release.
*/

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/

$app = new LaravelZero\Framework\Application(
dirname(__DIR__)
);

/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/

$app->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;
20 changes: 19 additions & 1 deletion packages/realtime-compiler/src/Concerns/InteractsWithLaravel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down