https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/src/BitcoinLib.php#313-328 This function generates a key pair + address.
The library doesn't use RPC calls, it's up to you to know what to use it for! You'd need either blockchains API or else some sort of transaction scraper to identify payments your addresses. A scraper gets complicated, since you need to be prepared for reorgs.
In your code, as I can see, to get new private key, the following are being used...
openssl_random_pseudo_bytes(32)
The second is in PHP lib, but is the first one ? If not, then how the first one is invoked ? I'm a little confused !!!
And, I'm not relying on a scraper to identify payment. Now, we have, multiple block explorers for bitcoin. We can check any address balance using their API and verify from multiple explorers.
Clone the project from Github, or download the zip file: https://github.com/Bit-Wasp/bitcoin-lib-php
You can use composer (https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/README.md#installation) to manage all this. Install, and then include "./vendor/autoload.php"
Check the examples folder on how to use it then!