Skip to content

Commit

Permalink
API Browser version 1.0.21, API client class version 1.1.9
Browse files Browse the repository at this point in the history
- API browser tool: added support for Kint (http://kint-php.github.io/kint/) for improved PHP array viewing
- API client class: no changes
  • Loading branch information
malle-pietje committed Aug 18, 2017
1 parent f6eafa3 commit 91761b6
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If you'd like to support further development of the API browser tool and the PHP
The UniFi API browser tool offers the following features:
- browse data collections/API endpoints exposed by the UniFi Controller API in an easy manner
- switch between sites managed by the connected controller
- switch between output formats (currently `json`, `PHP array`, `PHP var_dump`, `PHP var_export` and `json highlighted` have been implemented)
- switch between output formats (currently `json`, `PHP array`, `PHP var_dump`, `PHP var_export`, `json highlighted` and `PHP array using Kint` have been implemented)
- switch between default Bootstrap theme and the [Bootswatch](https://bootswatch.com/) themes
- an "About" modal which shows version information for PHP, cURL and the UniFi Controller
- very easy setup with minimal dependencies
Expand Down Expand Up @@ -95,6 +95,7 @@ Other included libraries:
- Font-awesome (version 4.7.0) https://fortawesome.github.io/Font-Awesome/
- jQuery (version 2.2.4) https://jquery.com/
- jQuery JSONView (version 1.2.3) https://github.com/yesmeck/jquery-jsonview
- Kint (version 2.1.2) http://kint-php.github.io/kint/
### Requirements
- a web server with PHP and cURL modules installed (tested on apache2 with PHP Version 5.6.1 and cURL 7.42.1)
Expand Down
15 changes: 13 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* the currently supported data collections/API endpoints in the README.md file
* - this tool currently supports versions 4.x and 5.x of the UniFi Controller software
*
* VERSION: 1.0.20
* VERSION: 1.0.21
*
* ------------------------------------------------------------------------------------
*
Expand All @@ -20,7 +20,7 @@
* with this package in the file LICENSE.md
*
*/
define('API_BROWSER_VERSION', '1.0.20');
define('API_BROWSER_VERSION', '1.0.21');

/**
* check whether the PHP curl module is available
Expand Down Expand Up @@ -82,6 +82,13 @@
*/
require_once('phpapi/class.unifi.php');

/**
* load the Kint class
* more info on Kint usage: http://kint-php.github.io/kint/
*/
require_once('kint/kint.php');
Kint::$display_called_from = false;

/**
* determine whether we have reached the cookie timeout, if so, refresh the PHP session
* else, update last activity time stamp
Expand Down Expand Up @@ -520,6 +527,9 @@ function print_output($output_format, $data)
case 'php_array':
print_r($data);
break;
case 'php_array_kint':
+d($data);
break;
case 'php_var_dump':
var_dump($data);
break;
Expand Down Expand Up @@ -669,6 +679,7 @@ function sites_sort($site_a, $site_b)
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nice but slow with large collections</li>
<li id="json_color"><a href="?output_format=json_color">json highlighted</a></li>
<li id="php_array_kint"><a href="?output_format=php_array_kint">PHP array using Kint</a></li>
</ul>
</li>
<li id="user-menu" class="dropdown">
Expand Down
Loading

0 comments on commit 91761b6

Please sign in to comment.