rs/socialite-doccheck
Composer 安装命令:
composer require rs/socialite-doccheck
包简介
Laravel Socialite provider for DocCheck SSO (OAuth 2.0).
README 文档
README
With the DocCheck Login you are able to very simply establish a protected area on your site, which is only accessible to (medical) professionals The DocCheck password protection is an identification service for medical sites which is compliant with the German law for pharmaceutical commercial information HWG (Heilmittelwerbegesetz)
Installation
You can install the package via composer:
composer require rs/socialite-doccheck
Installation & Basic Usage
Please see the Base Installation Guide, then follow the provider specific instructions below.
Add configuration to config/services.php
'doccheck' => [ 'client_id' => env('DOCCHECK_CLIENT_ID'), 'client_secret' => env('DOCCHECK_CLIENT_SECRET'), 'redirect' => env('DOCCHECK_REDIRECT_URI') ],
Add provider event listener
Configure the package's listener to listen for SocialiteWasCalled events.
Add the event to your listen[] array in app/Providers/EventServiceProvider. See the Base Installation Guide for detailed instructions.
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers \RedSnapper\SocialiteProviders\DocCheck\DocCheckExtendSocialite::class ], ];
Usage
DocCheck's OAuth 2.0 flow requires a language path segment in the authorize URL. Pass it via Socialite's with():
return Socialite::driver('doccheck') ->scopes(['name', 'email', 'occupation_detail']) ->with(['lang' => 'de']) ->redirect();
The package always requests the unique_id scope (DocCheck's mandatory system scope). Add any other scopes your application needs via ->scopes([...]). Available scopes include name, email, profession, occupation_detail, country, language, and address — see DocCheck's scopes documentation for the full list and license requirements. Requested scopes are presented to the user as optional ticks on the consent screen by default; if you need a scope to be required rather than optional, add it to the login-client's "Mandatory Scopes" in DocCheck Access.
After authentication, the user payload uses DocCheck's v2 keys (unique_id, first_name, last_name, email, discipline_id, profession_id). Declined optional scopes are simply omitted from the response — the package's accessors return null cleanly in that case.
Handling authorization errors
DocCheck can redirect back to your callback URL with an OAuth 2.0 error response (?error=…&error_description=…) — for example R0100_PROFESSION_NOT_ALLOWED when the user's profession isn't on the login-client's whitelist. The package surfaces this as a typed DocCheckAuthorizationException from ->user():
use RedSnapper\SocialiteProviders\DocCheck\DocCheckAuthorizationException; try { $user = Socialite::driver('doccheck')->user(); } catch (DocCheckAuthorizationException $e) { // $e->error e.g. 'R0100_PROFESSION_NOT_ALLOWED' or 'access_denied' // $e->errorDescription human-readable text from DocCheck, may be null return redirect()->route('login')->withErrors([ 'doccheck' => __('auth.doccheck.not_eligible'), ]); }
DocCheck shows its own branded error page before redirecting, so the user already knows roughly what happened — your handler just needs to land them somewhere coherent. The package deliberately does not enumerate DocCheck's error codes; branch on $e->error in your application as needed.
Upgrading from v1
v2 is a breaking change. v1 endpoints (login.doccheck.com) are being decommissioned by DocCheck on 2026-06-01. If your application is not yet ready to migrate, lock to ^1.0 — the v1.x tags remain available.
For full breaking-change details, see CHANGELOG.
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 param@redsnapper.net instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.
rs/socialite-doccheck 适用场景与选型建议
rs/socialite-doccheck 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.52k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 05 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rs」 「doccheck」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rs/socialite-doccheck 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rs/socialite-doccheck 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rs/socialite-doccheck 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 2.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-06