Download the PHP package kodepik/ums-laravel without Composer

On this page you can find all versions of the php package kodepik/ums-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ums-laravel

UMS Laravel SDK

Laravel package for SSO authentication & authorization via UMS (User Management System).

Package ini menyediakan:


Daftar Isi

  1. Requirements
  2. Installation
  3. Configuration
  4. Prasyarat di UMS Admin
  5. Quick Start — SSO Login
  6. Quick Start — API Bearer Token
  7. Middleware Reference
  8. Helper Functions
  9. UmsClaims Object
  10. Facade
  11. Implementasi Lengkap (Step by Step)
  12. Blade Template
  13. Advanced: Custom Routes
  14. Advanced: Token Refresh
  15. Troubleshooting
  16. Security Notes

Requirements


Installation

1. Install package

Package menggunakan Laravel auto-discovery — ServiceProvider dan Facade otomatis terdaftar.

2. Publish config

File config/ums.php akan dibuat.


Configuration

Tambahkan ke file .env:


Prasyarat di UMS Admin

Sebelum integrasi, pastikan di UMS Admin:

  1. Application sudah dibuat — catat app_id (contoh: APP-xxxxx)
  2. Callback URL didaftarkan — https://yourapp.com/ums/callback
  3. Logout redirect URL didaftarkan — https://yourapp.com/login
  4. User di-assign ke application — user yang bisa login
  5. Module, Role, Permission — sudah di-assign ke user sesuai kebutuhan

Quick Start — SSO Login

Setelah install dan config, SSO langsung bisa dipakai tanpa coding tambahan.

Auto-registered routes:

Route Method Name Fungsi
/ums/login GET ums.login Redirect ke UMS → Keycloak
/ums/callback GET ums.callback Handle callback setelah login
/ums/logout GET ums.logout Logout + redirect ke UMS logout
/ums/refresh POST ums.refresh Refresh token yang expired

Di halaman login kamu:

Setelah login berhasil:

User di-redirect ke /dashboard (configurable di UmsAuthController). Data tersimpan di session:

Logout:


Quick Start — API Bearer Token

Untuk API endpoint yang di-consume frontend/mobile, gunakan Bearer token:

Client mengirim request dengan header:


Middleware Reference

ums.auth — Validasi Token

Memastikan request memiliki Bearer token yang valid.

Response jika gagal:


ums.permission:module,permission — Cek Permission

Memastikan user punya permission tertentu di module tertentu.

Response jika gagal:


ums.role:module,role — Cek Role

Memastikan user punya role tertentu di module tertentu.

Response jika gagal:


ums.module:module — Cek Akses Module

Memastikan user punya akses ke module tertentu (tanpa cek permission/role spesifik).

Response jika gagal:


Kombinasi Middleware

Middleware bisa di-chain:


Helper Functions

Tersedia global helper yang bisa dipanggil dari mana saja:


UmsClaims Object

Object yang dikembalikan oleh ums_user():

Struktur modules:


Facade


Implementasi Lengkap (Step by Step)

Step 1: Install & Config

Tambahkan ke .env:

Step 2: Buat Login Page

Step 3: Buat Dashboard (Protected Page)

Step 4: Protect API Routes

Step 5: Controller dengan Middleware

Step 6: Conditional Logic di Service/Controller


Blade Template

Gunakan helper functions langsung di Blade:


Advanced: Custom Routes

Jika ingin handle sendiri tanpa auto-registered routes:

Lalu buat sendiri:


Advanced: Token Refresh

Otomatis (via endpoint)

SDK menyediakan POST /ums/refresh yang bisa dipanggil dari frontend:

Manual di backend


Troubleshooting

Problem Penyebab Solusi
"kid" empty, unable to lookup correct key UMS JWKS tidak memiliki kid field SDK sudah handle otomatis (v1.0+)
Invalid or expired token Token JWT sudah expired Login ulang atau panggil /ums/refresh
SSL certificate problem Self-signed cert di staging Set UMS_VERIFY_SSL=false di .env
Missing authorization token Request tanpa header Authorization: Bearer ... Tambahkan header Bearer token
Route /ums/login not found Package belum ter-register Jalankan composer dump-autoload dan clear cache
Redirect ke /login setelah callback Session hilang atau callback URL mismatch Pastikan UMS_CALLBACK_URL match dengan yang terdaftar di UMS
403 padahal user punya permission Nama module/permission case-sensitive Cek exact match dengan yang ada di UMS Admin
JWKS cache stale setelah key rotation Cache belum expired Panggil UMS::invalidateJwksCache() atau php artisan cache:clear

Session Data

Setelah SSO login berhasil, data berikut tersimpan di Laravel session:

Key Type Isi
ums_token string JWT access token
ums_refresh_token string Refresh token
ums_user array Decoded JWT claims

Security Notes


Sample Project

Lihat full working example di:

Untuk menjalankan:

Buka http://localhost:8000 → Login with SSO → lihat dashboard test.


All versions of ums-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0
firebase/php-jwt Version ^6.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kodepik/ums-laravel contains the following files

Loading the files please wait ...