eis3nhorn / scorm-cloud-laravel
为Laravel应用程序提供ScormCloud API网关
Requires
- php: >=7.0.0
- asifm42/scorm-cloud-php: dev-master
- illuminate/config: ~5.5.0
- illuminate/support: ~5.5.0
This package is auto-updated.
Last update: 2024-09-08 08:40:01 UTC
README
为Laravel应用程序提供ScormCloud API网关。
要求
此包可用于Laravel 5.4或更高版本。
安装
此库可通过Composer使用。
命令行
composer require eis3nhorn/scorm-cloud-laravel
Composer.json
{
"require": {
"eis3nhorn/scorm-cloud-laravel": "dev-master"
}
}
在Laravel 5.5中,服务提供程序将自动注册。在框架的旧版本中,只需在config/app.php文件中添加服务提供程序即可
'providers' => [ // ... eis3nhorn\ScormCloudGateway\ScormCloudServiceProvider::class, ];
配置
您可以通过发布配置文件或添加适当的环境变量来配置您的凭据。
环境变量
-
SCORMCLOUD_URL - 此属性是之前Rustici ScormCloud产品迭代的一个遗迹。它很可能不需要重写。但它在例如HTTPS无法支持等情况下存在。(默认:"https://cloud.scorm.com/EngineWebServices")
-
SCORMCLOUD_APPID - 应用程序ID(必需)
-
SCORMCLOUD_KEY - 与应用程序ID关联的秘密密钥(必需)
-
SCORMCLOUD_ORGANIZATION - 与应用程序关联的组织名称(默认:"scl")
-
SCORMCLOUD_APP_NAME - 应用程序名称(默认:"app")
-
SCORMCLOUD_VERSION - 版本号(默认:"1.0")
组织名称、应用程序名称和版本号用于创建源字符串。源字符串对于SCORM Cloud开发者端的调试很有用,但不是必需的。默认字符串将是"scl.app.1.0"。
您可以使用以下命令发布配置文件
php artisan vendor:publish --provider="eis3nhorn\ScormCloudGateway\ScormCloudServiceProvider" --tag="config"
发布后,config/scormcloud.php配置文件包含
return [ /** * The scorm engine service url. * * This attribute is a relic of a previous Rustici ScormCloud product * iteration. It will most likely not need to be overriden. But its * there for instances such as when HTTPS cannot be supported, etc. */ 'url' => env('SCORMCLOUD_URL', 'https://cloud.scorm.com/EngineWebServices'), /** * The application id * * Required */ 'app_id' => env('SCORMCLOUD_APPID', ''), /** * Any secret key associated with the app id * * Required */ 'key' => env('SCORMCLOUD_KEY', ''), /** * The organization name. * * This will be used to create an origin string which is useful * for debugging on the SCORM Cloud developers’ side * * optional */ 'organization' => env('SCORMCLOUD_ORGANIZATION', 'scl'), /** * The app name. * * This will be used to create an origin string which is useful * for debugging on the SCORM Cloud developers’ side * * optional */ 'app_name' => env('SCORMCLOUD_APP_NAME', 'app'), /** * The version number. * * This will be used to create an origin string which is useful * for debugging on the SCORM Cloud developers’ side * * optional */ 'version' => env('SCORMCLOUD_VERSION','1.0') ];
使用
您可以使用提供的助手访问网关
scormcloud()
您可以通过以下方式获取课程列表
scormcloud()->getCourses()