PHPackages                             anikeen/id - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. anikeen/id

ActiveLibrary[API Development](/categories/api)

anikeen/id
==========

PHP AnikeenId API Client for Laravel 10+

1.0.0(7mo ago)0409MITPHPPHP ^8.1

Since Apr 27Pushed 7mo agoCompare

[ Source](https://github.com/anikeen-com/id)[ Packagist](https://packagist.org/packages/anikeen/id)[ RSS](/packages/anikeen-id/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (25)Used By (0)

Anikeen ID
==========

[](#anikeen-id)

[![Latest Stable Version](https://camo.githubusercontent.com/8ad228c024de35e40ff9531549b11ec0f33d60ca40b45dc60f8e2025d027a55f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e696b65656e2f69642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/anikeen/id)[![Total Downloads](https://camo.githubusercontent.com/365f7e6161d7fed945e12b2e19699fa77c4d618cfdc04c6864d9ae58a9d64a50/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e696b65656e2f69642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/anikeen/id)[![License](https://camo.githubusercontent.com/c540476444b000cacc5364a17d849a05c470412ae02ff3ac484f536b984c8673/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616e696b65656e2f69642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/anikeen/id)

PHP Anikeen ID API Client for Laravel 11+

Table of contents
-----------------

[](#table-of-contents)

1. [Installation](#installation)
2. [Configuration](#configuration)
3. [General](#general)
4. [Examples](#examples)
5. [Documentation](#documentation)
6. [Development](#Development)

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

[](#installation)

```
composer require anikeen/id

```

Configuration
-------------

[](#configuration)

Add environmental variables to your `.env` file:

```
ANIKEEN_ID_KEY=
ANIKEEN_ID_SECRET=
ANIKEEN_ID_CALLBACK_URL=http://localhost/auth/callback

```

To switch from `production` to `staging` use following variable:

```
ANIKEEN_ID_MODE=staging

```

You will need to add an entry to the services configuration file so that after config files are cached for usage in production environment (Laravel command `artisan config:cache`) all config is still available.

Add to `config/services.php` file:

```
'anikeen' => [
    'mode' => env('ANIKEEN_ID_MODE'),
    'client_id' => env('ANIKEEN_ID_KEY'),
    'client_secret' => env('ANIKEEN_ID_SECRET'),
    'redirect' => env('ANIKEEN_ID_CALLBACK_URL'),
    'base_url' => env('ANIKEEN_ID_BASE_URL'),
],
```

### Event Listener

[](#event-listener)

In Laravel 11, the default EventServiceProvider provider was removed. Instead, add the listener using the listen method on the Event facade, in your `AppServiceProvider` boot method:

```
public function boot(): void
{
    Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
        $event->extendSocialite('anikeen', \Anikeen\Id\Socialite\Provider::class);
    });
}
```

### Registering Middleware

[](#registering-middleware)

Append it to the global middleware stack in your application's `bootstrap/app.php` file:

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \Anikeen\Id\Http\Middleware\CreateFreshApiToken::class,
    ]);
})
```

### Implementing Billable

[](#implementing-billable)

To implement the `Billable` trait, you need to add the `Billable` trait to your user model.

```
use Anikeen\Id\Billable;

class User extends Authenticatable
{
    use Billable;

    // Your model code...
}
```

then, you can use the `Billable` trait methods in your user model.

### Change the default access token / refresh token field name

[](#change-the-default-access-token--refresh-token-field-name)

If you access / refresh token fields differs from the default `anikeen_id_access_token` / `anikeen_id_refresh_token`, you can specify the field name in the `AppServiceProvider` boot method:

```
use Anikeen\Id\AnikeenId;

public function boot(): void
{
    AnikeenId::useAccessTokenField('anikeen_id_access_token');
    AnikeenId::useRefreshTokenField('anikeen_id_refresh_token');
}
```

### Implementing Auth

[](#implementing-auth)

This method should typically be called in the `boot` method of your `AppServiceProvider` class:

```
use Anikeen\Id\AnikeenId;
use Anikeen\Id\Providers\AnikeenIdUserProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

public function boot(): void
{
    Auth::provider('anikeen', function ($app, array $config) {
        return new AnikeenIdUserProvider(
            $app->make(AnikeenId::class),
            $app->make(Request::class),
            $config['model'],
            $config['fields'] ?? [],
        );
    });
}
```

reference the guard in the `guards` configuration of your `auth.php` configuration file:

```
'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'anikeen',
        'provider' => 'anikeen',
    ],
],
```

reference the provider in the `providers` configuration of your `auth.php` configuration file:

```
'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\Models\User::class,
    ],

    'anikeen' => [
        'driver' => 'anikeen',
        'model' => App\Models\User::class,
        'fields' => ['first_name', 'last_name', 'email'],
    ],
],
```

General
-------

[](#general)

#### Setters and Getters

[](#setters-and-getters)

```
$anikeenId = new Anikeen\Id\AnikeenId();

$anikeenId->setClientId('abc123');
$anikeenId->setClientSecret('abc456');
$anikeenId->setToken('abcdef123456');

$anikeenId = $anikeenId->withClientId('abc123');
$anikeenId = $anikeenId->withClientSecret('abc123');
$anikeenId = $anikeenId->withToken('abcdef123456');
```

#### Error handling for an unsuccessful query:

[](#error-handling-for-an-unsuccessful-query)

```
$result = $anikeenId->sshKeysByUserId('someInvalidId');

// Check, if the query was successfully
if (!$result->success()) {
    die('Ooops: ' . $result->error());
}
```

#### Shift result to get single key data:

[](#shift-result-to-get-single-key-data)

```
$result = $anikeenId->sshKeysByUserId('someValidId');

$sshKey = $result->shift();

echo $sshKey->name;
```

Examples
--------

[](#examples)

#### Get User SSH Key

[](#get-user-ssh-key)

```
$anikeenId = new Anikeen\IdAnikeenId();

$anikeenId->setClientId('abc123');

// Get SSH Key by User ID
$result = $anikeenId->sshKeysByUserId('someValidId');

// Check, if the query was successfully
if (!$result->success()) {
    die('Ooops: ' . $result->error());
}

// Shift result to get single key data
$sshKey = $result->shift();

echo $sshKey->name;
```

#### Create Order Preview

[](#create-order-preview)

```
$anikeenId = new \Anikeen\Id\AnikeenId();

// Create new Order Preview
$result = $anikeenId->createOrderPreview([
    'country_iso' => 'de',
    'items' => [
        [
            'type' => 'physical',
            'name' => 'Test',
            'price' => 2.99,
            'unit' => 'onetime',
            'units' => 1,
        ]
    ]
])->shift();

echo $preview->gross_total;
```

#### OAuth Tokens

[](#oauth-tokens)

```
$anikeenId = new Anikeen\Id\AnikeenId();

$anikeenId->setClientId('abc123');
$anikeenId->setToken('abcdef123456');

$result = $anikeenId->getAuthedUser();

$user = $userResult->shift();
```

```
$anikeenId->setToken('uvwxyz456789');

$result = $anikeenId->getAuthedUser();
```

```
$result = $anikeenId->withToken('uvwxyz456789')->getAuthedUser();
```

#### Facade

[](#facade)

```
use Anikeen\Id\Facades\AnikeenId;

AnikeenId::withClientId('abc123')->withToken('abcdef123456')->getAuthedUser();
```

Documentation
-------------

[](#documentation)

AnikeenId
---------

[](#anikeenid)

### Oauth

[](#oauth)

```
public function retrievingToken(string $grantType, array $attributes): Result
```

### ManagesPricing

[](#managespricing)

```
public function createOrderPreview(array $attributes = []): Result
```

### ManagesSshKeys

[](#managessshkeys)

```
public function sshKeysByUserId(string $sskKeyId): SshKeys
```

### ManagesUsers

[](#managesusers)

```
public function getAuthedUser(): Result
public function createUser(array $attributes): Result
public function isEmailExisting(string $email): Result
public function setParent(?mixed $parent): self
public function getParent()
```

Billable
--------

[](#billable)

### ManagesAddresses

[](#managesaddresses)

```
public function addresses(): Addresses
public function hasDefaultBillingAddress(): bool
```

### ManagesBalance

[](#managesbalance)

```
public function balance(): float
public function charges(): float
public function charge(float $amount, string $paymentMethodId, array $options = []): Transaction
```

### ManagesCountries

[](#managescountries)

```
public function countries(): Countries
```

### ManagesInvoices

[](#managesinvoices)

```
public function invoices(array $parameters = []): Invoices
```

### ManagesOrders

[](#managesorders)

```
public function orders(array $parameters = []): Orders
```

### ManagesPaymentMethods

[](#managespaymentmethods)

```
public function paymentMethods(): PaymentMethods
public function hasPaymentMethod(): ?PaymentMethod
public function defaultPaymentMethod(): ?PaymentMethod
public function hasDefaultPaymentMethod(): bool
public function billingPortalUrl(?string $returnUrl = null, array $options = []): string
public function createSetupIntent(array $options = []): Result
```

### ManagesProfile

[](#managesprofile)

```
public function profilePortalUrl(?string $returnUrl = null, array $options = []): string
```

### ManagesSubscriptions

[](#managessubscriptions)

```
public function subscriptions(): Subscriptions
```

### ManagesTaxation

[](#managestaxation)

```
public function vat(): float
```

### ManagesTransactions

[](#managestransactions)

```
public function transactions(): Transactions
```

[**OAuth Scopes Enums**](https://github.com/anikeen-com/id/blob/main/src/Enums/Scope.php)

Development
-----------

[](#development)

#### Run Tests

[](#run-tests)

```
composer test
```

```
BASE_URL=xxxx CLIENT_ID=xxxx CLIENT_KEY=yyyy CLIENT_ACCESS_TOKEN=zzzz composer test
```

#### Generate Documentation

[](#generate-documentation)

```
composer docs
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance63

Regular maintenance activity

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Recently: every ~0 days

Total

23

Last Release

230d ago

PHP version history (2 changes)1.0.0-alphaPHP ^8.0

1.0.0-alpha.8PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/64a10ad37cbd186601e725d894b9f35bdb9ec47782d9751a36e639d4ae795174?d=identicon)[envoyr](/maintainers/envoyr)

---

Top Contributors

[![envoyr](https://avatars.githubusercontent.com/u/81368729?v=4)](https://github.com/envoyr "envoyr (37 commits)")[![ghostzero](https://avatars.githubusercontent.com/u/6547306?v=4)](https://github.com/ghostzero "ghostzero (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anikeen-id/health.svg)

```
[![Health](https://phpackages.com/badges/anikeen-id/health.svg)](https://phpackages.com/packages/anikeen-id)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

765.7M124](/packages/saloonphp-laravel-plugin)[romanzipp/laravel-twitch

Twitch PHP Wrapper for Laravel

115121.1k4](/packages/romanzipp-laravel-twitch)[agence104/livekit-server-sdk

Server-side SDK for LiveKit.

79189.9k1](/packages/agence104-livekit-server-sdk)[grantholle/powerschool-api

A Laravel package to make interacting with PowerSchool less painful.

1715.6k1](/packages/grantholle-powerschool-api)[tamara-solution/php-sdk

Tamara PHP Client Library

10259.4k1](/packages/tamara-solution-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
