diff --git a/README.md b/README.md index 7231589..5aad649 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -Laravel 4.2 - Feed Reader +Laravel 5 - Feed Reader =============== -A simple RSS feed reader for **Laravel 4.2** +A simple RSS feed reader for **Laravel 5** ## Features @@ -13,7 +13,7 @@ A simple RSS feed reader for **Laravel 4.2** In the `require` key of `composer.json` file add the following: ``` -"awjudd/feed-reader": "1.1.*" +"awjudd/feed-reader": "1.2.*" ``` Run the Composer update command @@ -22,7 +22,7 @@ Run the Composer update command $ composer update ``` -In your `config/app.php` add `'Awjudd\Layoutview\LayoutviewServiceProvider'` to the end of the `$providers` array +In your `config/app.php` add `'Awjudd\FeedReader\FeedReaderServiceProvider'` to the end of the `$providers` array ```php 'providers' => array( diff --git a/composer.json b/composer.json index 2a46f39..077cc60 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "awjudd/feed-reader", - "description": "A simple RSS feed reader for Laravel 4.1", + "description": "A simple RSS feed reader for Laravel 5", "license": "MIT", "authors": [ { @@ -9,8 +9,8 @@ } ], "require": { - "php": ">=5.3.0", - "illuminate/support": "4.2.x", + "php": ">=5.4.0", + "illuminate/support": "~5", "simplepie/simplepie": "dev-master" }, "autoload": { @@ -19,4 +19,4 @@ } }, "minimum-stability": "dev" -} \ No newline at end of file +} diff --git a/src/Awjudd/FeedReader/FeedReader.php b/src/Awjudd/FeedReader/FeedReader.php index f470d35..f005e80 100644 --- a/src/Awjudd/FeedReader/FeedReader.php +++ b/src/Awjudd/FeedReader/FeedReader.php @@ -1,4 +1,10 @@ package('awjudd/feed-reader'); + $this->registerConfiguration(); } /** @@ -53,4 +60,31 @@ public function provides() return array('feed-reader'); } + /** + * Register configuration files, with L5 fallback + */ + protected function registerConfiguration() + { + // Is it possible to register the config? + if (method_exists($this->app['config'], 'package')) + { + $this->app['config']->package('awjudd/feed-reader', __DIR__ . '/config'); + } + else + { + // Derive the full path to the user's config + $userConfig = app()->configPath() . '/packages/awjudd/feed-reader/config.php'; + + // Check if the user-configuration exists + if(!file_exists($userConfig)) + { + $userConfig = __DIR__ .'/../../config/config.php'; + } + + // Load the config for now.. + $config = $this->app['files']->getRequire($userConfig); + $this->app['config']->set('feed-reader::config', $config); + } + } + } \ No newline at end of file