environment.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Load Environment Variables
  5. |--------------------------------------------------------------------------
  6. |
  7. | Next we will load the environment variables for the application which
  8. | are stored in the ".env" file. These variables will be loaded into
  9. | the $_ENV and "putenv" facilities of PHP so they stay available.
  10. |
  11. */
  12. try
  13. {
  14. Dotenv::load(__DIR__.'/../');
  15. Dotenv::required('APP_ENV');
  16. }
  17. catch (RuntimeException $e)
  18. {
  19. die('Application environment not configured.'.PHP_EOL);
  20. }
  21. /*
  22. |--------------------------------------------------------------------------
  23. | Detect The Application Environment
  24. |--------------------------------------------------------------------------
  25. |
  26. | Laravel takes a dead simple approach to your application environments
  27. | so you can just specify a machine name for the host that matches a
  28. | given environment, then we will automatically detect it for you.
  29. |
  30. */
  31. $env = $app->detectEnvironment(function()
  32. {
  33. return getenv('APP_ENV');
  34. });