c82481a28a
- added several monthly stats methods: `stat_monthly_gateway()`, `stat_monthly_site()`, `stat_monthly_aps()`, `stat_monthly_user()`, thanks go to @Roel Janssens for spotting these MongoDB collections - test for `object` or `resource` in `get_curl_resource()`, closes PR #82 submitted by @banakito - applied change to comments in `example/modify_smartpower_pdu_outlet.php` based on a suggestion by @thesohoguy - removed unnecessary variable from `list_apgroups()`, thanks go to Stephen Davies for reporting - added an optional parameter $ap_group_ids to the `create_wlan()` function/method for UniFi controller versions 6.0.X and higher, thanks go to Stephen Davies for contributing |
||
---|---|---|
.. | ||
site_provisioning_example | ||
ap_scanning_state.php | ||
ap_upgrade_firmware.php | ||
auth_guest_basic.php | ||
auth_guest_with_note.php | ||
block_list.php | ||
change_super_mgmt.php | ||
change_wlan_password.php | ||
config.template.php | ||
create_site.php | ||
create_voucher.php | ||
delete_site.php | ||
disable_device.php | ||
disable_switch_port.php | ||
execute_custom_api_request.php | ||
extend_guest_auth.php | ||
list_alarms.php | ||
list_ap_connected_users.php | ||
list_connected_users.php | ||
list_site_health.php | ||
list_social_auth_details.php | ||
list_user_stats.php | ||
modify_smartpower_pdu_outlet.php | ||
README.md | ||
reconnect_client.php | ||
test_connection.php | ||
toggle_led.php | ||
unblock_list.php | ||
update_ac-iw_ports.php | ||
update_device_wlan_settings_5.5.X.php | ||
update_switch_poe-mode.php |
API client class usage examples
This directory contains some PHP code examples which demonstrate usage of the PHP API client class and can be used as a good starting point for your own custom code.
Usage
Copy the appropriate example file to your working directory together with a copy of the config.template.php file which should be renamed to config.php. Then update the contents of your new config.php with your controller details and credentials and modify the example file as required to fit your needs.
Also make sure to update the path for the composer autoloader file (vendor/autoload.php
) or the file containing the Class itself (src/Client.php
) in your require_once()
statement as required.
Executing scripts from the CLI
Most of the included example scripts can be run from the CLI or shell as follows after the necessary credentials and parameters have been added or updated:
$ php list_site_health.php
NOTE: this does require the php-cli
module to be installed
Contribute
If you would like to share your own example file(s), please open an issue and include your code there or else create a pull request.
Important Disclaimer
Use these examples at your own risk!