pedroni / laravel-rd-station
Integrate your Laravel project with RD Station
Fund package maintenance!
pedroni
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-10-17 20:19:51 UTC
README
This is a Laravel wrapper around the RD Station API.
Installation
You can install the package via composer:
composer require pedroni/laravel-rd-station
You can publish the config file with:
php artisan vendor:publish --tag="rd-station-config"
This is the contents of the published config file:
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'), ];
⚠️ The env variable
RD_STATION_REDIRECT_PATH
MUST match your route endpoint that will be configured later
Publish migrations files and run the migrations:
php artisan vendor:publish --tag="rd-station-migrations"
php artisan migrate
Add two GET
routes for the installation controller and the callback controller, example:
// 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
Open a browser window on http://your-domain.com/rd-station/oauth/install to initiate the instalation.
⚠️ If you decide to change the recommended callback URL you MUST change the
RD_STATION_REDIRECT_PATH
variable
Usage
Using the facade
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'], ]);
Using dependency injection
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([...]); } }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.