i struggled with this, but during API work it was helpful. hoping this post will help others in a similar situation.
make a new file, i.e. /tmp/test.php
and you can test out scripts / API calls on demand via
sudo -u asterisk php /tmp/test.php
contents should be similar to:
<?php include '/etc/freepbx.conf'; $FreePBX = FreePBX::Create(); $user=$FreePBX->Core->getUser("5133"); echo print_r($user);