archer/clickatell-bundle
最新稳定版本:0.1.0
Composer 安装命令:
composer require archer/clickatell-bundle
包简介
Symfony ClickatellBundle
关键字:
README 文档
README
Prerequisites
This version of the bundle requires Symfony 2.1+
Translations
If you wish to use default texts provided in this bundle, you have to make sure you have translator enabled in your config.
# app/config/config.yml framework: translator: ~
For more information about translations, check Symfony documentation.
Installation
Installation is a quick 5 step process:
- Download ArcherClickatellBundle using composer
- Enable the Bundle
- Create your Message class
- Configure the ArcherClickatellBundle
- Update your database schema
Step 1: Download ArcherClickatellBundle using composer
Add ArcherClickatellBundle in your composer.json:
{
"require": {
"archer/clickatell-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command:
$ php composer.phar update archer/clickatell-bundle
Composer will install the bundle to your project's vendor/archer directory.
Step 2: Enable the bundle
Enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Archer\ClickatellBundle\ArcherClickatellBundle(), ); }
Step 3: Create your Message class
The goal of this bundle is to persist some Message class to a database (MySql,
MongoDB, CouchDB, etc).
The bundle provides base classes which are already mapped for most fields to make it easier to create your entity. Here is how you use it:
- Extend the base
Messageclass (the class to use depends of your storage) - Map the
idfield. It must be protected as it is inherited from the parent class.
Note:
The doc uses a bundle named
AcmeMessageBundle. If you want to use the same name, you need to register it in your kernel. But you can of course place your Message class in the bundle you want.
Warning:
If you override the __construct() method in your Message class, be sure to call parent::__construct(), as the base Message class depends on this to initialize some fields.
a) Doctrine ORM Message class
If you're persisting your message via the Doctrine ORM, then your message class
should live in the Entity namespace of your bundle and look like this to
start:
<?php // src/Acme/MessageBundle/Entity/Message.php namespace Acme\MessageBundle\Entity; use Archer\ClickatellBundle\Entity\Message as BaseMessage; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name="clickatell_message") */ class Message extends BaseMessage { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; public function __construct() { parent::__construct(); // your own logic } }
b) MongoDB Message class c) CouchDB Message class d) Propel Message class
Step 4: Configure the ArcherClickatell
Add the following configuration to your config.yml file according to which type
of datastore you are using.
# app/config/config.yml archer_clickatell: user: ~ # your username for clickatell password: ~ # your password for clickatell api_id: ~ # your id for clickatell message_class: Acme\MessageBundle\Entity\Message
# app/config/config.xml <!-- app/config/config.xml --> <archer_clickatell:config user="username" password="password" api-id="api_id" message-class="Acme\MessageBundle\Entity\Message" />
Step 5: Update your database schema
Now that the bundle is configured, the last thing you need to do is update your
database schema because you have added a new entity, the Message class which you
created in Step 4.
For ORM run the following command.
$ php app/console doctrine:schema:update --force
Usage Steps
//send Sms $form = $this->get('clickatell.send_message.form'); $form->bind($this->getRequest()); if ($form->isValid()) { $message = $form->getData(); $clickatell = $this->get('clickatell.http'); $response = $clickatell->sendMessage($message->getToPhone(), $message->getText()); }
archer/clickatell-bundle 适用场景与选型建议
archer/clickatell-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 49.63k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2012 年 11 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「clickatell」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 archer/clickatell-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 archer/clickatell-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 archer/clickatell-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Monolog Handler for SMS messaging services such as Twilio, Clickatell and Plivo.
This package makes it easy to send sms using clickatell.com with Laravel 5.
Clickatell notifications driver
PHP library for sending SMS through various gateways
Laminas module for sending SMS messages
统计信息
- 总下载量: 49.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-11-05