ids/login
最新稳定版本:v4.0.42
Composer 安装命令:
composer require ids/login
包简介
IDS authentication package
README 文档
README
Laravel authentication package for IDS (Identity Service). Provides login, registration, QR code authentication, account management, and UI customization — all backed by the IDS API.
Requires: PHP 8.2+ | Laravel 11 or 12
Installation
composer require ids/login
Then run the interactive setup wizard:
php artisan ids:install
This will prompt you for your IDS credentials, feature preferences, and automatically configure your .env, publish config/migrations/assets, and run migrations.
Manual Installation
If you prefer manual setup:
# Publish config
php artisan vendor:publish --tag=ids-login-config
# Publish migrations
php artisan vendor:publish --tag=ids-login-migrations
# Publish assets (CSS, JS, phone input plugin)
php artisan vendor:publish --tag=ids-login-assets
# Run migrations
php artisan migrate
Configuration
After installation, configure via .env:
# Required
IDS_HOST=https://your-ids-server.com
IDS_UDID=your-udid
IDS_PASSWORD_CLIENT_ID=your-client-id
IDS_PASSWORD_SECRET=your-client-secret
IDS_CLIENT_CREDENTIAL_CLIENT_ID=your-cc-client-id
IDS_CLIENT_CREDENTIAL_SECRET=your-cc-secret
IDS_LOGIN_REDIRECT_TO=/home
# Feature Flags (all optional)
IDS_QR_LOGIN_ENABLED=true
IDS_ACCOUNT_ENABLED=true
IDS_USE_LIVEWIRE=false
IDS_RECAPTCHA_ENABLED=false
IDS_LOGIN_RESTRICTED=false
IDS_LOGIN_ALLOW_LOCAL_AUTH=false
# QR Login (required if QR enabled)
IDS_QR_REDIRECT_ID=your-redirect-id
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=ap1
# Recaptcha (required if recaptcha enabled)
RECAPTCHA_SITE_KEY=
RECAPTCHA_SECRET_KEY=
Full configuration reference: config/ids-login.php
Features
Authentication
- Password login via IDS OAuth (password grant)
- QR code login via Pusher real-time events (toggleable)
- Local auth fallback when IDS server is unreachable
- Phone verification post-login flow
- Registration with OTP verification
- Password reset with OTP verification
- Recaptcha support (toggleable)
Account Management (toggleable)
- Update display name, email, phone, password, language, avatar
- OTP verification for email and phone changes
- Profile picture upload
UI Customization
- Database-driven settings via
/ids-settings - Custom logo, background, primary color, dark mode
- Configurable layout alignment
Multi-Tenancy
Supports Stancl Tenancy with two modes:
# In config/ids-login.php
'tenancy' => [
'enabled' => true,
'mode' => 'multi_db', // or 'single_db'
'middleware' => ['tenant'],
],
- multi_db — separate database per tenant (publish tenant migrations)
- single_db — shared database with
tenant_idcolumn scoping
Views
Ships with Blade views (default) and optional Livewire components.
Blade (default)
Works out of the box. Vanilla JS, no jQuery. To customize:
php artisan vendor:publish --tag=ids-login-views
Livewire (opt-in)
Set IDS_USE_LIVEWIRE=true in .env. Requires livewire/livewire ^3.0:
composer require livewire/livewire
Components: ids-login-form, ids-register-form, ids-forgot-password-form, ids-account-manager
Routes
All routes are prefixed with ids.:
| Name | Method | URI |
|---|---|---|
ids.login | GET | /login |
ids.login.submit | POST | /login |
ids.logout | POST | /logout |
ids.register | GET | /register |
ids.register.submit | POST | /register |
ids.register.otp | GET | /register/otp |
ids.register.verify-otp | POST | /register/verify-otp |
ids.password.request | GET | /password/reset |
ids.password.otp | POST | /password/reset/otp |
ids.password.reset | POST | /password/reset |
ids.phone.verify | GET | /phone-verification |
ids.qr.callback | POST | /qr-login/callback |
ids.qr.status | GET | /qr-login/status |
ids.account | GET | /my-account |
ids.account.name | POST | /account/name |
ids.account.phone | POST | /account/phone |
ids.account.email | POST | /account/email |
ids.account.password | POST | /account/password |
ids.account.language | POST | /account/language |
ids.account.avatar | POST | /account/avatar |
ids.settings | GET | /ids-settings |
ids.settings.store | POST | /ids-settings |
QR and Account routes are only registered when their feature flags are enabled.
User Model
The package adds these columns to your users table:
| Column | Type | Description |
|---|---|---|
ids_id | string | IDS system user ID |
ids_hash | string | Encrypted IDS identifier |
phone_no | string | Full phone number with country code (e.g. +60129718420) |
country_code | string | Country code (e.g. +60) |
country_phone_no | string | Local phone number without country code (e.g. 129718420) |
is_active | boolean | User active status |
Configure column mapping in config/ids-login.php under attributes if your column names differ.
Updating
composer update ids/login
php artisan ids:update
Translations
Supports English, Malay (ms), and Chinese (zh). Publish to customize:
php artisan vendor:publish --tag=ids-login-translations
Upgrading from v3
See the Migration Guide in the design spec.
Key breaking changes:
- PHP 8.2+ required (was 8.1+)
- Config keys restructured (run
php artisan ids:installto regenerate) - Route names now prefixed with
ids. - Account routes changed from
/ajax/update/*to/account/* - jQuery removed — views use vanilla JS
- All vplus references removed
License
Proprietary - IDS
统计信息
- 总下载量: 676
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2024-12-06