Skip to content

Commit a50d2e8

Browse files
authored
Fixing PSR-0 autoload issue (#227)
* Making the controller PSR-0 Compatible * Update composer.json * Dynamic base controller * Update LogViewerController.php * Dependency class namespace fix * Changing the package name back after testing * Updating documentation
1 parent dbfc09d commit a50d2e8

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $app->register(\Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::cl
4949

5050
Explicitly set the namespace in `app/Http/routes.php`:
5151
```php
52-
$router->group(['namespace' => '\Rap2hpoutre\LaravelLogViewer'], function() use ($router) {
52+
$router->group(['namespace' => '\Rap2hpoutre\Controllers'], function() use ($router) {
5353
$router->get('logs', 'LogViewerController@index');
5454
});
5555
```

src/controllers/BaseController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Rap2hpoutre\Controllers;
4+
5+
if (class_exists("\\Illuminate\\Routing\\Controller")) {
6+
class BaseController extends \Illuminate\Routing\Controller {}
7+
} elseif (class_exists("Laravel\\Lumen\\Routing\\Controller")) {
8+
class BaseController extends \Laravel\Lumen\Routing\Controller {}
9+
}

src/controllers/LogViewerController.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
<?php
22

3-
namespace Rap2hpoutre\LaravelLogViewer;
3+
namespace Rap2hpoutre\Controllers;
44

55
use Illuminate\Support\Facades\Crypt;
6-
7-
if (class_exists("\\Illuminate\\Routing\\Controller")) {
8-
class BaseController extends \Illuminate\Routing\Controller {}
9-
} elseif (class_exists("Laravel\\Lumen\\Routing\\Controller")) {
10-
class BaseController extends \Laravel\Lumen\Routing\Controller {}
11-
}
6+
use Rap2hpoutre\LaravelLogViewer\LaravelLogViewer;
127

138
/**
149
* Class LogViewerController

0 commit comments

Comments
 (0)