Search by

martinclaro / tacacs-php

nvellonmartinclaro

TACACS+ Client developed in PHP

Package info

gitlab.com/martinclaro/tacacs-php

Issues

pkg:composer/martinclaro/tacacs-php

Statistics

Installs: 4 535

Dependents: 0

Suggesters: 0

Stars: 0

2.0.0 2026-08-13 11:39 UTC

This package is auto-updated.

Last update: 2026-09-13 15:57:27 UTC


README

TACACS+ Client developed in PHP.

This is a proof of concept.

Supported Methods

  • PAP Authentication

TACACS+ Specification

For further information about TACACS+ please refer to: https://tools.ietf.org/html/draft-grant-tacacs-02

Version

2.0.0

Requirements

  • PHP 7.3 or newer, including PHP 8.x (continuous integration runs the test suite on 7.3, 7.4, 8.0, 8.1, 8.2, 8.3 and 8.4)
  • The sockets extension (ext-sockets)

Installation

As a dependency of your project:

$ composer require martinclaro/tacacs-php

Or from source:

$ git clone https://gitlab.com/martinclaro/tacacs-php.git tacacs-php
$ cd tacacs-php
$ composer install
$ php examples/tacacs-client.php

Usage

<?php
require_once __DIR__ . '/vendor/autoload.php';

use TACACS\Client;

$cli = new Client();
$cli->setServer('127.0.0.1', 49, 'testing123');
$cli->setTimeout(1.5);

$ok = $cli->authenticate('testuser', 'test1234', 'http', '192.168.197.122');

authenticate() takes the username, the password, the port name reported to the server, and the remote address of the user being authenticated. It returns a boolean and never throws on a network failure.

Pass any PSR-3 logger to the constructor (or to setLogger()) to get a full trace of the exchange, including the hex dump of every packet sent and received:

$cli = new Client(new Monolog\Logger('tacacs'));

See examples/tacacs-client.php for a complete runnable script.

Testing

$ vendor/bin/phpunit --configuration tests/phpunit.xml

No composer.lock is committed, so dependencies are resolved against whichever PHP you run.

For a coverage report (requires Xdebug), add:

$ XDEBUG_MODE=coverage vendor/bin/phpunit --configuration tests/phpunit.xml \
    --coverage-text --coverage-html tests/coverage

Development

Want to contribute? Great!

TODO's

  • MS-CHAP Authentication

License

GNU General Public License

Free Software, Hell Yeah!