New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

admn/admn-php

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

admn/admn-php

PHP Package To Interact With ADMN Service

Source
Packagist
Version
1.0.13
Version published
Total downloads
402
Maintainers
0
Created
Source

Installation:

composer require admn/admn-php

Usage:

use Admn\Admn\AuditLogger;

// Set API Token
AuditLogger::setCredentials($token, $secret);

// Full method definition
AuditLogger::create($actor, $action, $tags, $context);

// For a simple action logging
AuditLogger::create('email:'.$user->email, $action);

// If you wish to add tags
AuditLogger::create('email:john@doe.com', $action, ['account_update','ip:123.123.123.123']]);

// If you wish to add context
AuditLogger::create('phone:123-123-1234', $action, [], $contextData]);

// If you wish to add tags and context
AuditLogger::create('phone:123-123-1234', $action, ['type:account_update'], $contextData]);

// Or for a more structured call
AuditLogger::new()
    ->actor('stripe_id:123567')
    ->action('Updated contact details')
    ->tags(['ip:123.123.123.123'])
    ->context([
        'updated_contact_details' => [
            'first_name' => 'Bob',
            'email' => 'bob@builder.com'
        ]
    ])
    ->save();

Update/Add Actors

use Admn\Admn\ActorSync;
use Admn\Admn\AuditLogger;

// Set API Token
AuditLogger::setCredentials($token, $secret);

// Update or Create an actor in the system
ActorSync::single([
    'display' => 'John Doe',
    'identifiers' =>[
        [
            'key' => 'monster_id',
            'value' => 123
        ],
        [
            'key' => 'email',
            'value' => 'john@doe.com'
        ]
    ]
]);

ActorSync::bulk([
    [
        'display'     => 'John Doe',
        'identifiers' => [
            [
                'key'   => 'monster_id',
                'value' => 123,
            ],
            [
                'key'   => 'email',
                'value' => 'john@doe.com',
            ],
        ],
    ],
    [
        'display'     => 'Jane Doe',
        'identifiers' => [
            [
                'key'   => 'monster_id',
                'value' => 456,
            ],
            [
                'key'   => 'email',
                'value' => 'jane@doe.com',
            ],
            [
                'key'   => 'phone',
                'value' => '123-456-7890',
            ],
        ],
    ],
]);

FAQs

Package last updated on 13 Aug 2022

Related posts