Skip to content

Installation ​

Requirements ​

PHP8.2+
Laravel12 or 13
anikeen/id3.6+ (installed as a dependency)
Guzzle7.8+ or 8

Install ​

The repository is private for now. Ask Anikeen for access, then add it as a Composer VCS repository (with a GitHub token or deploy key in auth.json):

json
"repositories": [
    {"type": "vcs", "url": "https://github.com/anikeen-com/console-sdk"}
]
bash
composer require anikeen/console

The service provider and the AnikeenConsole facade are registered through package discovery.

Set up anikeen/id first ​

The SDK uses the user's Anikeen ID tokens. Set up anikeen/id first - login with Anikeen ID and storing the tokens on the user:

  1. Register the Socialite provider in your AppServiceProvider:

    php
    Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
        $event->extendSocialite('anikeen', \Anikeen\Id\Socialite\Provider::class);
    });
  2. Add the Anikeen ID columns to your users table:

    php
    Schema::table('users', function (Blueprint $table) {
        $table->string('anikeen_id')->nullable()->unique();
        $table->text('anikeen_id_access_token')->nullable();
        $table->text('anikeen_id_refresh_token')->nullable();
    });

    Keep the tokens encrypted ('encrypted' casts) and out of JSON ($hidden).

  3. Request the Console scopes in the login and store the token pair in the callback:

    php
    use Anikeen\Id\Enums\Scope;
    use Laravel\Socialite\Facades\Socialite;
    
    Route::get('auth/redirect', fn () => Socialite::driver('anikeen')
        ->scopes([Scope::CONSOLE_CONTAINERS])
        ->redirect());
    
    Route::get('auth/callback', function () {
        $account = Socialite::driver('anikeen')->user();
    
        $user = User::updateOrCreate(['anikeen_id' => $account->getId()], [
            'name' => $account->getName() ?: $account->getNickname(),
            'email' => $account->getEmail(),
            'anikeen_id_access_token' => $account->token,
            'anikeen_id_refresh_token' => $account->refreshToken,
        ]);
    
        Auth::login($user, remember: true);
    
        return redirect()->intended('/');
    });

See the anikeen/id README for details. Which scopes to request is explained on Scopes.

Next: Configuration.

Anikeen Console documentation