hokibgs/auth-center

There is no license information available for the latest version (v1.0.1) of this package.

Maintainers

Package info

github.com/smboutsource/auth-center-php

pkg:composer/hokibgs/auth-center

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2025-12-12 13:22 UTC

This package is not auto-updated.

Last update: 2026-04-04 12:56:29 UTC


README

Library PHP untuk login ke SMB Auth Center

Instalasi

composer require hokibgs/auth-center

Cara Penggunaan

🔧 Inisialisasi Client

use Hokibgs\AuthCenter\AuthCenter;

$auth = new AuthCenter(
    apiUrl: 'https://auth-center.example.com',
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret'
);

🔐 Login

$response = $auth->login('email@example.com', 'password123');

👤 Ambil Profile

$auth->setToken('auth-token');
$profile = $auth->getProfile('email@example.com');

📡 Request GET

$auth->setToken('auth-token');
$response = $auth->get('/users');

📝 Request POST

$response = $auth->post('/auth/register', [
    'email' => 'user@example.com',
    'password' => 'secret',
    'password_confirmation' => 'secret',
]);

🔄 Request PUT

$auth->setToken('auth-token');
$response = $auth->put('/auth/change-password', [
    'old_password' => 'oldpass',
    'password' => 'newpass',
]);

❌ Request DELETE

$auth->setToken('auth-token');
$response = $auth->delete('/account/remove', ['email' => 'user@example.com']);

📤 Menambahkan Custom Headers

$auth->setHeaders([
    'X-My-App' => 'CustomHeaderValue'
]);