PHP code example of rapkis / laravel-controld

1. Go to this page and download the library: Download rapkis/laravel-controld library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rapkis / laravel-controld example snippets


return [
    'url' => env('CONTROL_D_API_URL'),
    'secret' => env('CONTROL_D_API_SECRET'),
    'middleware' => [
        'request' => [],
        'response' => [ControlDErrorHandlerMiddleware::class],
    ],
];

$controlD = app(\Rapkis\Controld\ControlD::class); // or use DI

// Lists all profiles of your account: https://docs.controld.com/reference/get_profiles
$controlD->profiles()->list();

// Create a new profile: https://docs.controld.com/reference/post_profiles
$profile = $controlD->profiles()->create('My Profile Name'); // returns \Rapkis\Controld\Responses\Profile

// Create a new device that uses your new profile: https://docs.controld.com/reference/post_devices
$device = $controlD->devices()->create(
    'Device Name', // the name of your device
    $profile->pk, // the profile it will use
    'router', // the icon (type) of your device. Purely visual.
); // returns \Rapkis\Controld\Responses\Device
bash
php artisan vendor:publish --tag="laravel-controld-config"