Art-of-WiFi / UniFi-API-client

A PHP API client class to interact with Ubiquiti's UniFi Controller API
MIT License
1.09k stars 217 forks source link

Solution for issue #199 #203

Closed SamuelSchnelly closed 6 months ago

SamuelSchnelly commented 7 months ago

Implementation of the solution for issue 199.

Solution: public function set_port_vlan ( $device_mac, $port_idx, $vlan_id ).

Including an example of the use of the function in examples/set_vlan_to_port.php.

SamuelSchnelly commented 7 months ago

Fault:

You are using Composer 1 which is deprecated. You should upgrade to Composer 2, see https://blog.packagist.com/deprecating-composer-1-support/
Loading composer repositories with package information
Peer fingerprint did not match
https://repo.packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Updating dependencies (including require-dev)

  [Composer\Downloader\TransportException]                                                                                                                                                  
  The "https://packagist.org/p/art-of-wifi/unifi-api-client%24b32e667a105dae143207af6d844aa440a30f3c052271765fb0da18950fc3248f.json" file could not be downloaded (HTTP/1.1 404 Not Found)  

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
malle-pietje commented 7 months ago

Thanks for the PR. This quite a lot of logic that may be better off in your own code; I need to think about this a bit.

Regarding the composer error; I don't see how that is related to this repo. We use composer 2.4.1 on our dev server and don't see such errors.

SamuelSchnelly commented 7 months ago

The problem arose when testing the project after sending the request.

More details are available on https://scrutinizer-ci.com/g/Art-of-WiFi/UniFi-API-client/inspections/f8e4d433-11fb-4045-af0e-94593e79ef62

malle-pietje commented 7 months ago

Hmm, TBH I have no clue why this was triggered. Maybe it's a temporary glitch in the matrix...?

malle-pietje commented 6 months ago

Decided not to add this to the source code, instead we'll add an example to demonstrate this approach.