evilfreelancer / pihole-api-php
Pi-Hole API PHP client
dev-master
2020-02-29 19:24 UTC
Requires
- php: >=7.3
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^6.0
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-10-29 04:53:41 UTC
README
Pi-Hole API PHP client
composer require evilfreelancer/pihole-api-php
How to use
$config = new \PiHole\Config([ 'webpassword' => '6b600e5555af97b26ed51a5910a0b310d9da8e22a7aaf97ab0137bb4880ec55e', 'base_url' => 'http://192.168.1.10/admin/api.php' ]); $client = new \PiHole\Client($config); // Get all stats $statistics = $client->statistics()->exec(); print_r($statistics); // Get version of PiHole $version = $client->version()->exec(); print_r($version); // Enable ADBlocking on PiHole $enable = $client->enable()->exec(); print_r($enable); // Disable ADBlocking on PiHole $disable = $client->disable()->exec(); print_r($disable); // Logout from PiHole $logout = $client->logout()->exec(); print_r($logout);