pedroni / laravel-rd-station
将您的 Laravel 项目与 RD Station 集成
v3.0.0
2023-09-17 17:55 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- illuminate/contracts: ^8.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- nunomaduro/collision: ^5.10
- nunomaduro/larastan: ^1.0
- orchestra/testbench: ^6.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-17 20:12:43 UTC
README
这是一个围绕 RD Station API 的 Laravel 封装。
安装
您可以通过 composer 安装此包
composer require pedroni/laravel-rd-station
您可以使用以下命令发布配置文件
php artisan vendor:publish --tag="rd-station-config"
这是已发布配置文件的内容
return [ 'base_url' => env('RD_STATION_BASE_URL', 'https://api.rd.services'), 'client_id' => env('RD_STATION_CLIENT_ID'), // REQUIRED 'client_secret' => env('RD_STATION_CLIENT_SECRET'), // REQUIRED 'redirect_path' => env('RD_STATION_REDIRECT_PATH', 'rd-station/oauth/callback'), ];
⚠️ 环境变量
RD_STATION_REDIRECT_PATH
必须 与您稍后配置的路由端点匹配
发布迁移文件并运行迁移
php artisan vendor:publish --tag="rd-station-migrations"
php artisan migrate
为安装控制器和回调控制器添加两个 GET
路由,例如
// routes/web.php use Pedroni\RdStation\Controllers\OAuthInstall; use Pedroni\RdStation\Controllers\OAuthCallback; Route::get('rd-station/oauth/install', OAuthInstall::class); Route::get('rd-station/oauth/callback', OAuthCallback::class); // recommended
在 http://your-domain.com/rd-station/oauth/install 上打开浏览器窗口以启动安装。
⚠️ 如果您决定更改推荐的回调 URL,您 必须 更改
RD_STATION_REDIRECT_PATH
变量
使用方法
使用外观
use Pedroni\RdStation\Facades\RdStation; RdStation::events()->conversion([ 'email' => 'example@mail.com', 'conversion_identifier' => 'identifier', 'cf_example' => 'An example of custom field', 'tags' => ['example-tag'], ]);
使用依赖注入
use Pedroni\RdStation; public function ExampleController { public function exampleUsingAnArgument(RdStation $rdStation) { $rdStation->events()->conversion([...]); } public function exampleUsingLaravelContainer() { $rdStation = app()->make(RdStation::class); $rdStation->events()->conversion([...]); } }
测试
composer test
变更日志
有关最近更改的更多信息,请参阅 CHANGELOG
贡献
有关详细信息,请参阅 CONTRIBUTING
安全漏洞
请查阅 我们的安全策略 了解如何报告安全漏洞。
鸣谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件