devstrefa/esemeser 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

devstrefa/esemeser

Composer 安装命令:

composer require devstrefa/esemeser

包简介

PHP Library for sending SMS through esemeser.pl API

README 文档

README

PHP Library designed to sending SMS messages through esemeser.pl API

Before you use it!

Esemeser.pl is a Polish service for sending SMS messages, so remember that You can send messages only to Polish phone numbers those numbers must be in format: xxxxxxxxx (9 digits), other numbers probably will not work.

This library is using file_get_contents as default mechanism to send requests, so before You start using it, make sure you have properly configured environment. Check if your allow_url_fopen is set to "1". You can use CURL instead of file_get_contents please read below to get more information.

How to install

Library is compatible with composer so You can install it by adding:

"require": {
        "devstrefa/esemeser": "1.0.x-dev"
    }

to Your composer.json file

You can also download zip file and include all necessary files by yourself

How to use

Library is designed for 2 main tasks:

1. Sending Messages

Below you can see example of code sending some message:

<?php

use DevStrefa\Esemeser\Esemeser;
use DevStrefa\Esemeser\Message;
use DevStrefa\Esemeser\MessageType;

require_once ('../vendor/autoload.php');

try {

    $esemeser = new Esemeser();    
    $esemeser->setLogin('login')->setAccount('account_name')->setPassword('password');
    
    $message = new Message();
    $message->setClientName('client_name')->setPhoneNumber('123456789')->setMessage('test')->setMessageType(MessageType::ECO);
    $esemeser->send($message);

} catch (\Exception $e){
    var_dump($e);
}

2. Checking Balance

Second function of library is checking how many messages of given type You can still send with Your current balance. To do this use library like in code below:

<?php

use DevStrefa\Esemeser\Esemeser;
use DevStrefa\Esemeser\MessageType;

require_once ('../vendor/autoload.php');

try {

    $esemeser = new Esemeser();
    $esemeser->setLogin('login')->setAccount('account_name')->setPassword('password');

    $balance=$esemeser->checkBalance(MessageType::ECO);

    echo $balance;
   

} catch (\Exception $e){
    var_dump($e);
}

How to use CURL instead of file_get_contents

Since version 1.1.0 of library, You can choose mechanism which is used to make requests to API, if you want to do this add this line to Your code:

$esemeser->setRequestMethod('fgc');

available values for setRequestMethod are:

  • fgc - for file_get_contents
  • curl - for curl library

For more information about library please read generated documentation.

Changelog

You can see Changelog for this project here

License

Whole code in this repository is Under MIT license

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固