PHPackages                             stimata/portal-sdk - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. stimata/portal-sdk

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

stimata/portal-sdk
==================

Official PHP SDK for STIMATA Portal V2 OAuth2 Authorization Server with native Laravel support

v1.0.2(1mo ago)05↓100%MITPHPPHP ^8.2|^8.3CI failing

Since Apr 27Pushed 1mo agoCompare

[ Source](https://github.com/stimata-team-dev/stimata-portal-sdk)[ Packagist](https://packagist.org/packages/stimata/portal-sdk)[ RSS](/packages/stimata-portal-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (7)Versions (4)Used By (0)

STIMATA Portal SDK
==================

[](#stimata-portal-sdk)

Official PHP SDK for STIMATA Portal V2 OAuth2 Authorization Server with native Laravel support.

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![PHP Version](https://camo.githubusercontent.com/b43c9d6cd8939c4868f963284928566c4c35dd2da0725c027f95a3d62f2f0329/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342532422d626c75652e737667)](https://www.php.net/)[![Laravel](https://camo.githubusercontent.com/1e071dc62eb0a9073a28b42c0306c2af96973184655092cf13a10d9ad37b0710/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d38253230746f25323031332d7265642e737667)](https://laravel.com/)

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- Laravel 8.x - 13.x (for Laravel integration)
- cURL extension
- JSON extension

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

[](#installation)

### Via Composer

[](#via-composer)

```
composer require stimata/portal-sdk
```

### Laravel Setup (Auto-Discovered)

[](#laravel-setup-auto-discovered)

The package uses Laravel's auto-discovery. After installation, publish the config:

```
php artisan vendor:publish --tag=stimata-config
```

### Environment Configuration

[](#environment-configuration)

Add to your `.env` file:

```
STIMATA_CLIENT_ID=your-client-id
STIMATA_CLIENT_SECRET=your-client-secret
STIMATA_REDIRECT_URI=https://yourapp.com/auth/callback
STIMATA_BASE_URL=https://auth.stimata.ac.id/api
STIMATA_AUTO_REFRESH=true
STIMATA_SSL_VERIFY=true
```

### Register Middleware

[](#register-middleware)

**Laravel 8-10** (`app/Http/Kernel.php`):

```
protected $routeMiddleware = [
    'stimata.auth' => \Stimata\Portal\Middleware\StimataAuth::class,
    'stimata.access' => \Stimata\Portal\Middleware\StimataCheckAccess::class,
];
```

**Laravel 11+** (`bootstrap/app.php`):

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->alias([
        'stimata.auth' => \Stimata\Portal\Middleware\StimataAuth::class,
        'stimata.access' => \Stimata\Portal\Middleware\StimataCheckAccess::class,
    ]);
})
```

Quick Start
-----------

[](#quick-start)

### Laravel Authentication Flow

[](#laravel-authentication-flow)

**1. Create Auth Controller**

```
