Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #11 from awjudd/development
Browse files Browse the repository at this point in the history
Laravel 5 Support
  • Loading branch information
awjudd committed Mar 23, 2015
2 parents 069403f + d746d6d commit edb0c61
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand All @@ -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": {
Expand All @@ -19,4 +19,4 @@
}
},
"minimum-stability": "dev"
}
}
8 changes: 7 additions & 1 deletion src/Awjudd/FeedReader/FeedReader.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?php namespace Awjudd\FeedReader;
/**
* @Author: Andrew Judd
* @Date: 2015-03-22 22:16:19
* @Last Modified by: Andrew Judd
* @Last Modified time: 2015-03-22 22:25:59
*/

use Config;
use SimplePie;
Expand Down Expand Up @@ -97,6 +103,6 @@ private function setup_cache_directory($configuration)
*/
private function read_config($configuration, $name, $default)
{
return Config::get('feed-reader::profiles.' . $configuration . '.' . $name, $default);
return Config::get('feed-reader::config.profiles.' . $configuration . '.' . $name, $default);
}
}
38 changes: 36 additions & 2 deletions src/Awjudd/FeedReader/FeedReaderServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<?php namespace Awjudd\FeedReader;
/**
* @Author: Andrew Judd
* @Date: 2015-03-22 22:16:19
* @Last Modified by: Andrew Judd
* @Last Modified time: 2015-03-22 22:22:37
*/

use Illuminate\Support\ServiceProvider;

class FeedReaderServiceProvider extends ServiceProvider {
class FeedReaderServiceProvider extends ServiceProvider
{

/**
* Indicates if loading of the provider is deferred.
Expand All @@ -18,7 +25,7 @@ class FeedReaderServiceProvider extends ServiceProvider {
*/
public function boot()
{
$this->package('awjudd/feed-reader');
$this->registerConfiguration();
}

/**
Expand Down Expand Up @@ -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);
}
}

}

0 comments on commit edb0c61

Please sign in to comment.