index.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * Laravel - A PHP Framework For Web Artisans
  4. *
  5. * @package Laravel
  6. * @author Taylor Otwell <taylorotwell@gmail.com>
  7. */
  8. /*
  9. |--------------------------------------------------------------------------
  10. | Register The Auto Loader
  11. |--------------------------------------------------------------------------
  12. |
  13. | Composer provides a convenient, automatically generated class loader
  14. | for our application. We just need to utilize it! We'll require it
  15. | into the script here so that we do not have to worry about the
  16. | loading of any our classes "manually". Feels great to relax.
  17. |
  18. */
  19. require __DIR__.'/../bootstrap/autoload.php';
  20. /*
  21. |--------------------------------------------------------------------------
  22. | Turn On The Lights
  23. |--------------------------------------------------------------------------
  24. |
  25. | We need to illuminate PHP development, so let's turn on the lights.
  26. | This bootstraps the framework and gets it ready for use, then it
  27. | will load up this application so that we can run it and send
  28. | the responses back to the browser and delight these users.
  29. |
  30. */
  31. $app = require_once __DIR__.'/../bootstrap/start.php';
  32. /*
  33. |--------------------------------------------------------------------------
  34. | Capture The Request
  35. |--------------------------------------------------------------------------
  36. |
  37. | Next we will capture the HTTP request into an instance of the Symfony
  38. | request class. We will then pass that to a Laravel application for
  39. | processing and return the response we receive back from the app.
  40. |
  41. */
  42. use Symfony\Component\HttpFoundation\Request;
  43. $request = Request::createFromGlobals();
  44. /*
  45. |--------------------------------------------------------------------------
  46. | Run The Application
  47. |--------------------------------------------------------------------------
  48. |
  49. | Once we have the application, we can simply call the run method,
  50. | which will execute the request and send the response back to
  51. | the client's browser allowing them to enjoy the creative
  52. | and wonderful application we have whipped up for them.
  53. |
  54. */
  55. $response = with(new Stack\Builder)
  56. ->push('Illuminate\Foundation\TrailingSlashRedirector')
  57. ->resolve($app)
  58. ->handle($request);
  59. /*
  60. |--------------------------------------------------------------------------
  61. | Close The Application & Send Response
  62. |--------------------------------------------------------------------------
  63. |
  64. | When closing the application, the session cookies will be set on the
  65. | request. Also, this is an opportunity to finish up any other work
  66. | that needs to be done before sending this response to browsers.
  67. |
  68. */
  69. $app->callCloseCallbacks($request, $response);
  70. $response->send();
  71. /*
  72. |--------------------------------------------------------------------------
  73. | Shutdown The Application
  74. |--------------------------------------------------------------------------
  75. |
  76. | Once the app has finished running we'll fire off the shutdown events
  77. | so that any end work may be done by an application before we shut
  78. | off the process. This is the final thing to happen to requests.
  79. |
  80. */
  81. $app->terminate($request, $response);