From 0a94daba76d92f8395d56472bac2f00a23bdf1d1 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 11 May 2014 12:55:24 +0200 Subject: [PATCH] illuminate config for non-laravel use --- composer.json | 3 ++- src/Intervention/Image/ImageManager.php | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index f8848ab8..b6405920 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "require": { "php": ">=5.3.0", "ext-fileinfo": "*", - "illuminate/support": "4.1.*" + "illuminate/support": "4.1.*", + "illuminate/config": "4.1.*" }, "require-dev": { "phpunit/phpunit": "3.*", diff --git a/src/Intervention/Image/ImageManager.php b/src/Intervention/Image/ImageManager.php index 2f8aee56..600706d6 100644 --- a/src/Intervention/Image/ImageManager.php +++ b/src/Intervention/Image/ImageManager.php @@ -2,6 +2,10 @@ namespace Intervention\Image; +use Illuminate\Config\Repository as Config; +use Illuminate\Config\FileLoader; +use Illuminate\Filesystem\Filesystem; + class ImageManager { public $config; @@ -15,8 +19,13 @@ class ImageManager } else { - $loader = new FileLoader(new Filesystem, __DIR__.'/../../config'); - $this->config = new Config($loader, null); + $config_path = __DIR__.'/../../config'; + $env = 'production'; + + $file = new Filesystem; + $loader = new FileLoader($file, $config_path); + $this->config = new Config($loader, $env); + $this->config->package('intervention/image', $config_path, 'image'); } }