Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
NFarrington committed Apr 10, 2017
2 parents 3364752 + f692722 commit 8e2440e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
VatsimXMLFeeds
=========

The Vatsim Xmlfeeds package is a useful laravel package for accessing data publically presented via VATSIMs XML feeds.
The Vatsim Xmlfeeds package is a useful laravel 5 package for accessing data publically presented via VATSIMs XML feeds.

Version
----

1.0
2.2 (Lumen Supported)

Installation
--------------

Use [Composer](http://getcomposer.org) to install the VatsimXML and dependencies.

```sh
$ composer require vatsim/xml 1.*
$ composer require vatsim/xml 2.*
```

### Laravel
#### Set up
Using VatsimXML in Laravel is made easy through the use of Service Providers. Add the service provider to your `app/config/app.php` file:
Using VatsimXML in Laravel is made easy through the use of Service Providers. Add the service provider to your `config/app.php` file:
```php
'providers' => array(
// ...
Expand Down
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
"wiki": "https://github.com/A-Lawrence/VatsimXML/wiki"
},
"require": {
"php": ">=5.4.0",
"php": ">=5.5.9",
"illuminate/support": "5.*"
},
"autoload": {
"classmap": [
"src/migrations"
],
"psr-0": {
"Vatsim\\Xml\\": "src/"
}
Expand Down
24 changes: 18 additions & 6 deletions src/Vatsim/Xml/XmlServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class XmlServiceProvider extends ServiceProvider {
* @var bool
*/
protected $defer = false;

public function dir($path){
return __DIR__."/../../".$path;
}

/**
* Bootstrap the application events.
Expand All @@ -30,13 +34,21 @@ public function boot()
*/
public function register()
{
$this->mergeConfigFrom(
__DIR__.'/../../config/config.php', 'vatsimxml'
);
$request = $this->app['request'];

// Lumen users need to copy the config themselves
// And it needs to pulled completely differently.
// So more work required. Luckily barryvdh had the answer - so thanks.
if(str_contains($this->app->version(), "Lumen")){
$this->app->configure("vatsim-xml");
} else {
$this->publishes([
$this->dir("config/config.php") => config_path("vatsim-xml.php"),
]);
}

$this->app['vatsimxml'] = $this->app->share(function($app)
{
return new XML($app['config']->get('vatsimxml'));
$this->app['vatsimxml'] = $this->app->share(function($app){
return new XML( $this->app["config"]->get("vatsim-xml") );
});
}

Expand Down

0 comments on commit 8e2440e

Please sign in to comment.