cometcast / openapi-php-sdk-laravel
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/cometcast/openapi-php-sdk-laravel
Requires
- php: ^7.2|^8.0
- cometcast/openapi-php-sdk: v20251127-beta
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
- phpunit/phpunit: ^8.0|^9.0|^10.0|^11.0|^12.0
This package is not auto-updated.
Last update: 2025-11-27 15:55:40 UTC
README
這是一個為 Laravel 框架設計的 Cometcast OpenAPI SDK 套件,提供 OIDC 認證功能。
安裝
透過 Composer 安裝套件:
composer require cometcast/php-sdk-laravel
發布配置檔案
發布套件配置檔案到您的應用程式:
php artisan vendor:publish --provider="Cometcast\OpenApi\Laravel\PhpSdkLaravelServiceProvider" --tag="config"
這會在 config/cometcast-openapi.php 建立配置檔案。
環境變數設定
在您的 .env 檔案中設定以下 OIDC 相關環境變數:
# OIDC 客戶端 ID COMETCAST_OPENAPI_CLIENT_ID=your_client_id # OIDC 重導向 URI COMETCAST_OPENAPI_REDIRECT_URI=your_redirect_uri # OIDC 客戶端密鑰 COMETCAST_OPENAPI_CLIENT_SECRET=your_client_secret # OIDC 認證伺服器基礎 URL COMETCAST_OPENAPI_AUTH_BASEURL=https://your-auth-server.com # OIDC 授權範圍 COMETCAST_OPENAPI_SCOPES=openid,profile,email # OpenAPI 基礎 URL COMETCAST_OPENAPI_BASE_URL=https://your-api-server.com # SSL 驗證設定(開發環境可設為 false) COMETCAST_OPENAPI_SSL_VERIFY=false
使用方式
OIDC 登入URL 示範 (Controller)
use Cometcast\Openapi\OpenIdProvider; public function index(OpenIdProvider $oidcProvider) { $provider->setPkceCode('pkce-code'); $url = $provider->getAuthorizationUrl('authorization_code', [ 'ui_locales' => 'zh_TW' // 指定語系 ]); return redirect()->to($url); }
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email slps970093@gmail.com instead of using the issue tracker.
Credits
License
The Apache License 2. Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.