Laravel-activitylog: Lumen support

Created on 21 Mar 2017  路  7Comments  路  Source: spatie/laravel-activitylog

Hello

Can this be used for Lumen with smal changes? I get an error

Call to undefined function Spatie\Activitylog\config_path()

Thx in advance

Most helpful comment

It works well with lumen 5.4.*, the only problem I've met is
Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\\Auth\\AuthManager which is caused by https://github.com/spatie/laravel-activitylog/blob/master/src/ActivityLogger.php#L33 and can be solve by adding

$app->singleton(Illuminate\Auth\AuthManager::class, function ($app) {
    return $app->make('auth');
});

to bootstrap/app.php.

The solution was comes from https://github.com/tymondesigns/jwt-auth/issues/561

All 7 comments

I don't use Lumen myself, so I don't know for sure.

But I guess this package can be used if you write your own Lumen compatible service provider.

It works well with lumen 5.4.*, the only problem I've met is
Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\\Auth\\AuthManager which is caused by https://github.com/spatie/laravel-activitylog/blob/master/src/ActivityLogger.php#L33 and can be solve by adding

$app->singleton(Illuminate\Auth\AuthManager::class, function ($app) {
    return $app->make('auth');
});

to bootstrap/app.php.

The solution was comes from https://github.com/tymondesigns/jwt-auth/issues/561

Hi @xcaptain , Can you give me instruction, how can i integrate this package on lumen please? it will be helpful. Thanks in advance.

How about a special lumen section or splitted readme how to adjust/use it with lumen?

hi @Gummibeer , it will be good if you provide an special section for lumen. Thanks

@omar-faruk-sust sorry for being late, can you paste your problems, in my case this package works well with lumen, below are my config steps.

  1. add service provider to bootstrap/app.php
    $app->register(Spatie\Activitylog\ActivitylogServiceProvider::class);
  2. copy config files
    cp vendor/spatie/laravel-activitylog/config/activitylog.php config/
  3. manual specific config file, edit bootstrap/app.php
    $app->configure('activitylog');
  4. add a help function to bootstrap/app.php
if (! function_exists('config_path')) {
    function config_path($path = '')
    {
        return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
    }
}

I'm using lumen 5.5.2 and activitylog 2.5.1

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ianrussel picture ianrussel  路  5Comments

jeangomes picture jeangomes  路  5Comments

lucianobosco picture lucianobosco  路  5Comments

rjcrystal picture rjcrystal  路  5Comments

TheFrankman picture TheFrankman  路  5Comments