PHP code example of lecodeurdudimanche / php-bluetooth
1. Go to this page and download the library: Download lecodeurdudimanche/php-bluetooth 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/ */
lecodeurdudimanche / php-bluetooth example snippets
use lecodeurdudimanche\PHPBluetooth\Manager;
$manager = new Manager($discoverable, $pairable);
use lecodeurdudimanche\PHPBluetooth\Device;
$manager->scanDevices(); //Initiate device scan
$manager->setPairable(false);
$manager->pairDevice(new Device($mac));
$manager->updateBluetoothInfo();
$data = $manager->getBluetoothInfo();
foreach($data->getAvailableDevices() as $device)
{
if (! $device->paired)
$manager->blockDevice($device);
}
// Other methods are available, see Manager class
composer