A simple switch with a low waste of resources and fast response time.
Install the package with composer by executing the command:
composer require "skepticspriggan/yii2-switch:*"
<?php
use SkepticSpriggan\Switch;
echo Switch::widget([
'label' => 'Light',
'checked' => true,
'onUrl' => Url::to(['light/on']),
'offUrl' => Url::to(['light/off']),
]);
?>