Permalink
Browse files

Adding support for lumen (#35)

* Adding support for lumen
* Ensure we are looking for the boolean value not the index 0
  • Loading branch information...
1 parent bad91f2 commit dd28bea1baf9c1d2e4f9a0a224c5cf1cb513b304 @nathanmac nathanmac committed with marcqualie Oct 8, 2016
Showing with 41 additions and 15 deletions.
  1. +22 −0 README.md
  2. +0 −11 config/config.php
  3. +11 −0 config/statsd.php
  4. +8 −4 src/Laravel5/Provider/StatsdServiceProvider.php
View
@@ -61,6 +61,28 @@ Find the `aliases` key in your `app/config/app.php` and add the Statsd Facade Al
]
```
+For Lumen:
+
+Register the provider in your boostrap app file ```boostrap/app.php```
+
+Add the following line in the "Register Service Providers" section at the bottom of the file.
+
+```php
+$app->register(\League\StatsD\Laravel5\Provider\StatsdServiceProvider::class);
+```
+
+Copy the config file ```statsd.php``` manually from the directory ```/vendor/league/statsd/config``` to the directory ```/config ``` (you may need to create this directory).
+
+Package Configuration
+
+In your `.env` file, add the configuration:
+
+```php
+STATSD_HOST=127.0.0.1
+STATSD_PORT=8125
+STATSD_NAMESPACE=
+```
+
## Usage
### Configuring
View
@@ -1,11 +0,0 @@
-<?php
-
-return [
- 'host' => '127.0.0.1',
-
- 'port' => 8125,
-
- 'namespace' => '',
-
- 'throwConnectionExceptions' => true,
-];
View
@@ -0,0 +1,11 @@
+<?php
+
+return [
+ 'host' => env('STATSD_HOST', '127.0.0.1'),
+
+ 'port' => env('STATSD_PORT', 8125),
+
+ 'namespace' => env('STATSD_NAMESPACE', ''),
+
+ 'throwConnectionExceptions' => true
+];
@@ -20,10 +20,14 @@ class StatsdServiceProvider extends ServiceProvider
*/
public function boot()
{
- // Publish config files
- $this->publishes([
- __DIR__.'/../../../config/config.php' => config_path('statsd.php'),
- ]);
+ if (false !== strpos($this->app->version(), 'Lumen')) {
+ $this->app->configure('statsd');
+ } else {
+ // Publish config files
+ $this->publishes([
+ __DIR__ . '/../../../config/statsd.php' => config_path('statsd.php'),
+ ]);
+ }
}
/**

0 comments on commit dd28bea

Please sign in to comment.