@@ -61,6 +61,12 @@ class instead of the usual ``AppKernel`` class::
6161 $kernel = new ApiKernel('dev', true);
6262 // ...
6363
64+ ..tip ::
65+
66+ Another approach is to keep the existing front controller (e.g. ``app.php `` and
67+ ``app_dev.php ``), but add an ``if `` statement to load the different kernel based
68+ on the URL (e.g. if the URL starts with ``/api ``, use the ``ApiKernel ``).
69+
6470Step 2) Create the new Kernel Class
6571~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6672
@@ -99,6 +105,20 @@ they don't collide with the files from ``AppKernel``::
99105 }
100106 }
101107
108+ In order for the autoloader to find your new ``ApiKernel ``, make sure you add it
109+ to your ``composer.json `` autoload section:
110+
111+ {
112+ "...": "..."
113+
114+ "autoload": {
115+ "psr-4": { "": "src/" },
116+ "classmap": [ "app/AppKernel.php", "app/AppCache.php", "app/ApiKernel.php" ]
117+ }
118+ }
119+
120+ Then, run ``composer install `` to dump your new autoload config.
121+
102122Step 3) Define the Kernel Configuration
103123~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104124