PHP code example of mapik / radius-client

1. Go to this page and download the library: Download mapik/radius-client 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/ */

    

mapik / radius-client example snippets




use Mapik\RadiusClient\Client;
use Mapik\RadiusClient\Packet;
use Mapik\RadiusClient\PacketType;

$client = new Client('udp://127.0.0.1:1812', /* timeout */ 2);
$response = $client->send(new Packet(PacketType::ACCESS_REQUEST(), /* secret */ 'xyzzy5461', [
    'User-Name' => 'nemo',
    'User-Password' => 'arctangent',
]));

if ($response->getType() !== PacketType::ACCESS_ACCEPT()) {
    throw new \RuntimeException('Unable to authenticate as user "nemo"');
}