Better object initialisation

Taomyn
2008-11-09
2013-04-11
  • Taomyn
    Taomyn
    2008-11-09

    I would recommend renaming the function "sms" to "init_sms". This would allow you to provide account details and any other paramters to the library before creating the object. For example:

    require_once ("sms_api.php");

    $mysms = new sms();

    $mysms->api_id = "123456";
    $mysms->user = "Username";
    $mysms->password = "password";
    $mysms->use_ssl = true;
    $mysms->sending_method = "fopen";

    $mysms->init_sms();

    It's easier for maintaining one version of this library and specifying in our own code what parameters we want.

    I thought I mentioned this once before with v1.5 or earlier but when I upgraded to v1.6 the new code failed in my scripts.