Automatically creating Email/FTP/Alias with PHP

is there a way to automatically create a user's Email account, FTP account, and/or Email alias using PHP, and have it show up through the cPanel (as if it was done through cPanel)?

i.e. I may want to have a php page that a user can fill out a form with username/password, and when submitted, it will create a Email and/or FTP account with those users user/pass submitted through the form. Or for Email aliases, the form can submit the requested alias at that domain, and their email they would like to use for that alias.

I know how to handle forms and PHP, but I do not know how to handle automatic creation of such things (Email and FTP accounts, and Email aliases) without manually going through cPanel.... but I'd still like to use cPanel to manage them... I'm just trying to automate some things (users being able to "register" and automatically generating their Email, FTP and/or Alias accounts, without myself having to go to cPanel and do/create each user manually)

I would still use cPanel to maintain them, though (and i LOVE cPanel!).

just trying to avoid manually entering 300+ Email and FTP accounts... and aliases..