juanparati/inmobile
InMobile client for Laravel
2,844
| Install | |
|---|---|
composer require juanparati/inmobile |
|
| Latest Version: | 1.5 |
| PHP: | >=8.1 |
| License: | MIT |
| Last Updated: | Aug 18, 2026 |
| Links: | GitHub · Packagist |
Maintainer: juanparati
InMobile library for Laravel
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
Related Packages
rinvex/laravel-authy
Rinvex Authy is a simple wrapper for Authy TOTP, the best rated Two-Factor Authe...
78,132
32