Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installign whithout composer #19

Open
mouhamadkamara opened this issue Feb 20, 2017 · 1 comment
Open

Installign whithout composer #19

mouhamadkamara opened this issue Feb 20, 2017 · 1 comment

Comments

@mouhamadkamara
Copy link

Hi , Im facing issue installing the lib . im not using composer ans do not want to use it can you tell me how can i install the sms lib whithout using composer ?

Thanks in advance !

@flo-sch
Copy link

flo-sch commented Mar 29, 2017

Hey @mouhamadkamara,

(Sad that you do not want to use composer in my opinion, it's very easy to use and the beneficts are huge!)

You can always download a version of the library as an archive (.zip) :

https://github.com/ovh/php-ovh-sms/archive/master.zip

Then you will need to include it in your project with manual require or include calls,
I did not do that for years but if I remember correctly, something like this should work.

WARNING: non-tested code!

require_once __DIR__ . '/../path/to/the/library/src/SmsApi';
require_once __DIR__ . '/../path/to/the/library/src/Message';

Then you should be able to use those classes in the same way as composer :

// Replace the identifiants with the one you wish to use
$smsClient = new SmsApi('your-app-key', 'your-app-secret', 'ovh-eu', 'your-consumer-key');

// Get declared accounts
$accounts = $smsClient->getAccount();

// Get declared senders
$senders = $smsClient->getSenders();

if ((count($accounts) > 0) && (count($senders) > 0)) { 
    $smsClient->setAccount($accounts[0]);
    $smsClient->setSender($senders[0]);

    $sms = $smsClient->createMessage();

    // Phone number who will receive the SMS
    $sms->addReceiver('+33601020304');

    // Define SMS options
    $sms->setIsMarketing(false);
    $sms->setDeliveryDate(new DateTime('now'));

    // Send the message
    $sms->send('This is a test message');
} else {
    die('Unable to send SMS : there is no account or sender defined for those credentials.');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants