juanparati/inmobile
Composer 安装命令:
composer require juanparati/inmobile
包简介
InMobile client for Laravel
README 文档
README
InMobile library for Laravel.
Installation
composer require juanparati/inmobile
Configuration
Publish configuration file:
artisan vendor:publish --tag="inmobile"
Usage examples
List service
Create list
InMobile::lists()->create('My list');
Get all lists
// Return a paginated results instance. $lists = InMobile::lists()->all(); // Will automatically transverse all the pages automatically. // Rewind is not allowed. foreach ($lists as $list) var_dump($list->toArray());
Get a list
InMobile::lists()->find($myListId);
Create a list
InMobile::lists()->create('My new list');
Get all recipients in list
$recipients = InMobile::lists()->getRecipients($myListId); // Will automatically transverse all the pages automatically. // Rewind is not allowed. foreach ($recipients as $recipient) var_dump($recipient->toArray());
Other methods
- update
- delete
- truncate
Recipient service
Create recipient
$recipient = InMobile::recipients()->create( $listId, \Juanparati\InMobile\Models\Recipient::make('45', '12345678') ->addField('firstname', 'John') ->addField('lastname', 'Random') ->addField('custom1', 'foobar') ->setCreatedAt(now()->subMinute()) ); echo 'Recipient id: ' . $recipient->getId();
Update recipient
// Only update some fields InMobile::recipients()->updateById( $listId, $recipientId, \Juanparati\InMobile\Models\Recipient::make() ->addField('firstname', 'John') ->addField('lastname', 'Random') ->addField('custom1', 'foobar'), false // Indicate that only values set are updated (Default) ); // Full update InMobile::recipients()->updateById( $listId, $recipientId, \Juanparati\InMobile\Models\Recipient::make('35', '12345678') ->addField('firstname', 'John') ->addField('lastname', 'Random') ->addField('custom1', 'foobar') ->setCreatedAt(now()) , true // Indicate that all fields are update, the fields missing in the recipient model are emptied ); // or use updateByNumber instead (It's slower than updateById because it has to lookup for the recipient Id) InMobile::recipients()->updateByNumber( $listId, $prefix, $number, \Juanparati\InMobile\Models\Recipient::make() ->addField('firstname', 'John') ->addField('lastname', 'Random') ->addField('custom1', 'foobar') );
Find recipient by Id
if ($recipient = InMobile::recipients()->findById('listid', 'recipientId')) { echo 'Recipient ' . $recipient->getId() . ' has phone +' . $recipient->getCode() . ' ' . $recipient->getPhone(); var_dump($recipient->toArray()); } else { echo 'Recipient not found'; }
Find recipient
// Search by phone number $recipient = InMobile::recipients()->findByNumber('listid', '45', '12345678'); // or search by recipient id $recipient = InMobile::recipients()->findById('listid', 'recipientId');
Other methods
- deleteById
- deleteByNumber
- updateOrCreateByNumber
- moveToList
Blacklist service
Methods
- all
- create
- findById
- findByNumber
- deleteById
- deleteByNumber
Email service
Send message
$message = \Juanparati\InMobile\Models\Message( '+45', '1234567', 'from me', 'Hello world' ); InMobile::sms()->send([$message]);
Send template message
$templateMessage = \Juanparati\InMobile\Models\MessageTemplate::make('+45', '1234567'); $templateMessage->addPlaceholder('{NAME}', 'John Random'); InMobile::sms()->sendUsingTemplate('FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', [$templateMessage]);
Email template service
Methods
- all
- find
Gdpr service
- create
Sms service
Methods
- send
- sendUsingTemplate
- cancel
- status
juanparati/inmobile 适用场景与选型建议
juanparati/inmobile 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.69k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 10 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「client」 「sms」 「laravel」 「inmobile」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 juanparati/inmobile 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 juanparati/inmobile 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 juanparati/inmobile 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Mock PSR-18 HTTP client
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
Asynchronous MQTT client built on React
yii2-sms expand
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
统计信息
- 总下载量: 2.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-03