File tree 2 files changed +12
-1
lines changed
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)
38
38
* Create a Symfony application
39
39
*
40
40
* @return \AppKernel
41
+ * @throws \Exception
41
42
*/
42
43
public function getApplication ()
43
44
{
@@ -54,7 +55,13 @@ public function getApplication()
54
55
(new \Symfony \Component \Dotenv \Dotenv ())->load (realpath ('.env ' ));
55
56
}
56
57
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
+ }
58
65
59
66
//since we need to change some services, we need to manually change some services
60
67
$ 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
12
12
13
13
composer require php-pm/httpkernel-adapter
14
14
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
+
15
19
> ** Note** : For Symfony, make sure your ` AppKernel ` is autoloaded in your
16
20
> ` composer.json ` (shouldn't be an issue for projects created using the Standard
17
21
> Edition after November 2015):
You can’t perform that action at this time.
0 commit comments