عميل Fazland Skebby Rest هو عميل REST غير رسمي لـ SMS SMS Italian SMS GatewayProvider Skebby.
php > = 7.4php xml extensionsymfony/options-resolvergiggsey/libphonenumber-for-php > = 8.0 طريقة التثبيت المقترحة هي عبر الملحن:
$ composer require fazland/skebby-rest-clientإنه أمر بسيط حقًا. بادئ ذي بدء ، التكوين!
معلمات التكوين الإلزامية هي:
usernamepasswordsendermethod ما عليك سوى إنشاء كائن Client يمر إلى المُنشئ المعلمات كصفيف:
$ this -> skebbyRestClient = new Client ([
' username ' => ' your_username ' ,
' password ' => ' your_password ' ,
' sender ' => ' +393333333333 ' ,
' method ' => SendMethods:: CLASSIC ,
' encoding_scheme ' => EncodingSchemas:: NORMAL , // Optional
' charset ' => Charsets:: UTF8 , // Optional
' endpoint_uri ' => ' https://gateway.skebby.it/api/send/smseasy/advanced/rest.php ' // (default)
]); يمكنك أيضًا تعيين القيم validity_period delivery_start
لإنشاء الرسائل القصيرة فقط اتبع المثال:
Sms:: create ()
-> setRecipients ([
' +393473322444 ' ,
' +393910000000 '
])
-> setRecipientVariables ( ' +393473322444 ' , [
' name ' => ' Mario ' ,
' quest ' => ' Go and rescue Peach, Bowser kidnapped her! '
])
-> setRecipientVariables ( ' +393910000000 ' , [
' name ' => ' Luigi ' ,
' quest ' => ' Help Mario, Bowser is really bad!! '
])
-> setText ( ' Hey ${name}! ${quest} ' )
; فقط استخدم Client::send(Sms $sms) لإرسال الرسائل القصيرة!
$ client -> send ( $ sms );سيرسل عميل واحد الرسائل القصيرة من خلال الطريقة التي حددتها في التكوين. إذا كنت ترغب في إرسالها من خلال طريقة أخرى ، فما عليك سوى إنشاء عميل جديد.
يمكنك الاستفادة من نظام الأحداث المفضل لديك ، طالما أنه ينفذ PSR-14. فقط تمرير المرسل الخاص بك كوسيطة ثالثة من مُنشئ العميل:
$ dispatcher = new EventDispatcher (); // any dispatcher implementing EventDispatcherInterface
$ options = [ /* .. */ ]; // see above for detailed options
$ this -> skebbyRestClient = new Client ( $ options , null , $ dispatcher ); في كل مرة يتم إرسال الرسائل القصيرة ، سيتم إرسال FazlandSkebbyRestClientEventSmsMessageEvent .
يجري
$ vendor/bin/phpunitالمساهمات موضع ترحيب. لا تتردد في فتح العلاقات العامة أو تقديم مشكلة هنا على Github!
عميل Skebby Rest مرخص بموجب ترخيص معهد ماساتشوستس للتكنولوجيا - راجع ملف الترخيص للحصول على التفاصيل