sashapekh/vf-api-service

向 API 服务站点发送数据

1.0.2 2021-02-08 17:39 UTC

This package is auto-updated.

Last update: 2024-09-09 01:29:55 UTC


README

安装

composer require sashapekh/vf-api-service

发布文件

php artisan vendor:publish --provider="Sashapekh\VfApi\VfApiServiceProvider" --force

运行迁移

php artisan make:migration

向 .env 文件添加变量

VF_SERVICE_URL= <domain service>

VF_SERVICE_TOKEN_URI= <uri for get token>

VF_SERVICE_SMS_MULTIPLE= <uri for send multiple phones one message>

VF_SERVICE_SMS_ONE= <uri for send a message for one phone>

VF_SERVICE_USER= <user for service>

VF_SERVICE_PASSWORD=< password for service>

代码中使用

发送到一个手机

        return (new SendSmsService())->sendOneSms("<phone>", "<message>");

向一组手机发送相同消息

        return (new SendSmsService())->sendMultipleSms(['array of phones'], "<message>");

返回值

    if error on server side, or could not resolve host return - null
    if has success request , return - json string with data