File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ public function initialize($appenv, $debug)
3838 * Create a Symfony application
3939 *
4040 * @return \AppKernel
41+ * @throws \Exception
4142 */
4243 public function getApplication ()
4344 {
@@ -54,7 +55,13 @@ public function getApplication()
5455 (new \Symfony \Component \Dotenv \Dotenv ())->load (realpath ('.env ' ));
5556 }
5657
57- $ class = class_exists ('\AppKernel ' ) ? '\AppKernel ' : '\App\Kernel ' ;
58+ $ namespace = getenv ('APP_KERNEL_NAMESPACE ' ) ?: '\App \\' ;
59+ $ fqcn = $ namespace . (getenv ('APP_KERNEL_CLASS_NAME ' ) ?: 'Kernel ' );
60+ $ class = class_exists ($ fqcn ) ? $ fqcn : '\AppKernel ' ;
61+
62+ if (!class_exists ($ class )) {
63+ throw new \Exception ("Symfony Kernel class was not found in the configured locations. Given: ' $ class' " );
64+ }
5865
5966 //since we need to change some services, we need to manually change some services
6067 $ app = new $ class ($ this ->appenv , $ this ->debug );
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ HttpKernel adapter for use of Symfony and Laravel frameworks with PHP-PM. See ht
1212
1313 composer require php-pm/httpkernel-adapter
1414
15+ 3 . Optionally provide the namespace of your Kernel using the ` APP_KERNEL_NAMESPACE ` environment variable.
16+ Example: ` APP_KERNEL_NAMESPACE=Acme\MyProduct\ ` . This will attempt to use the class ` Acme\MyProduct\Kernel `
17+ as the fully qualified class name
18+
1519> ** Note** : For Symfony, make sure your ` AppKernel ` is autoloaded in your
1620> ` composer.json ` (shouldn't be an issue for projects created using the Standard
1721> Edition after November 2015):
You can’t perform that action at this time.
0 commit comments