承接 notifea/notifea-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

notifea/notifea-php

Composer 安装命令:

composer require notifea/notifea-php

包简介

Pure PHP repository for Notifea services.

README 文档

README

Pure PHP repository for using Notifea services.

Notifea provides clients very user-friendly way of sending transactional emails and sms to their users.

Install

To install the SDK you need to be using Composer in your project. To install it please see the docs.

After you installed Composer install the SDK

composer require notifea/notifea-php

Minimum requirements

This package will require you to use:

Usage

All email and sms endpoints are accessed via NotifeaClient. First start by configuring this client.

$client = new NotifeaClient(
    'https://api.notifea.com/v1',
    'Bearer {authorization}'
);

Your authentication token can be generated in access-tokens section.

Usage - emails

To interact with email endpoints use EmailService. First start by instantiating.

$client = new NotifeaClient(
    'https://api.notifea.com/v1',
    'Bearer {authorization}'
);

$emailService = new EmailService($client);

Send email

Sending an email can be as simple as using this few lines of code:

$email = new Email();
$email->setFrom('newadress@notifea.com', 'New Address')
    ->setRecipient('customer@business.com')
    ->setReplyTo('reply_to@notifea.com')
    ->setSubject('My first email')
    ->setHtmlBody('<p>This is my first email</p>')
    ->setCc('cc@notifea.com')
;

$sentEmail = $emailService->sendEmail($email);

$sentEmail will contain updated Email object with all interesting information.

Get emails

To get emails, use this piece of code:

$emails = $emailService->getEmails();

$emails will be a new Collection containing all returned Email objects

Get single email

To get a single email entity, only email uuid is needed:

$email = $emailService->getEmail('8fc2c850-81c0-4424-823a-aa4727441864');

$email will be an Email object

Delete email

To delete a single email entity from notifea database, usage of this function is sufficient

$result = $emailService->deleteEmail('8fc2c850-81c0-4424-823a-aa4727441864');

$result will be an either true on successful deletion or NotifeaException will be triggered on any failure (such as email not found)

Usage - sms

To interact with sms endpoints use SmsService. First start by instantiating.

$client = new NotifeaClient(
    'https://api.notifea.com/v1',
    'Bearer {authorization}'
);

$smsService = new SmsService($client);

Send sms

Sending an sms can be as simple as using this few lines of code:

$sms = new Sms();
$sms
    ->setRecipient('+421902739429')
    ->setSmsSenderid('59634971-e57f-44af-b530-038e27e7064e')
    ->setContent('My awesome SMS message.')
;

$sentSms = $smsService->sendSms($sms);

$sentSms will contain updated Sms object with all interesting information.

To find out what is your sms_sender_id go into your Management section of your sms senders.

Get sms

To get all sms, use this piece of code:

$smss = $smsService->getSmss();

$smss will be a new Collection containing all returned Sms objects

Get single sms

To get a single sms entity, only sms uuid is needed:

$sms = $smsService->getSms('8fc2c850-81c0-4424-823a-aa4727441864');

$sms will be an Sms object

Delete sms

To delete a single sms entity from notifea database, this function is sufficient

$result = $smsService->deleteSms('8fc2c850-81c0-4424-823a-aa4727441864');

$result will be an either true on successful deletion or NotifeaException will be triggered on any failure (such as sms not found)

Usage - sms senders

Since May our customers may interact with sms senders by using SmsSenderService. This is especially handy if you need to have different Sender Names shown in your SMS

First start by instantiating.

$client = new NotifeaClient(
    'https://api.notifea.com/v1',
    'Bearer {authorization}'
);

$smsSenderService = new SmsSenderService($client);

Create sms sender

Creating an sms sender can be as simple as using this few lines of code:

$smsSender = new SmsSender();
$smsSender
    ->setSenderName('My Sender')
;

$createdSmsSender = $smsSenderService->createSmsSender($smsSender);

$createdSmsSender will contain updated SmsSender object with all interesting information such as your sms_sender_id that you need for sending SMS.

Get sms senders

To get all sms senders, use this piece of code:

$smsSenders = $smsSenderService->getSmsSenders();

$smsSenders will be a new Collection containing all returned SmsSender objects

Get single sms sender

To get a single sms sender entity, only sms sender uuid is needed:

$smsSender = $smsSenderService->getSmsSender('8fc2c850-81c0-4424-823a-aa4727441864');

$smsSender will be an SmsSender object

Update sms sender

To update a single sms sender entity, you may use updateSmsSender() method and pass in an SmsSender object with the updated data

$smsSender = new SmsSender();
$smsSender
    ->setUuid('8fc2c850-81c0-4424-823a-aa4727441864') // required in order to know which sms sender do you wish to update
    ->setSenderName('My New Name')
    ->setLiveTime(25)
;

$result = $smsSenderService->updateSmsSender($smsSender);

Delete sms sender

To delete a single sms sender entity from notifea database, this function is sufficient

$result = $smsSenderService->deleteSmsSender('8fc2c850-81c0-4424-823a-aa4727441864');

$result will be an either true on successful deletion or NotifeaException will be triggered on any failure (such as sms sender not found)

Community

Contributing

Dependencies are managed through composer:

$ composer install

Tests can be run via phpunit:

$ vendor/bin/phpunit

notifea/notifea-php 适用场景与选型建议

notifea/notifea-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.06k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 05 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sms」 「emails」 「email-sending」 「sms-sending」 「transactional-emails」 「transactional-sms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 notifea/notifea-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 notifea/notifea-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 notifea/notifea-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-15