PHPackages                             merlinthemagic/mtm-signal-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. merlinthemagic/mtm-signal-api

ActiveLibrary[API Development](/categories/api)

merlinthemagic/mtm-signal-api
=============================

PHP Signal Api

12491[6 issues](https://github.com/merlinthemagic/MTM-Signal/issues)PHP

Since Oct 5Pushed 4y ago2 watchersCompare

[ Source](https://github.com/merlinthemagic/MTM-Signal)[ Packagist](https://packagist.org/packages/merlinthemagic/mtm-signal-api)[ RSS](/packages/merlinthemagic-mtm-signal-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MTM-Signal
==========

[](#mtm-signal)

What is this?
-------------

[](#what-is-this)

Send and receive messages using the Signal Messenger. This project is a wrapper for [Signal-CLI](https://github.com/AsamK/signal-cli) giving you a simple OOP API for using signal in a PHP environment.

Install:
--------

[](#install)

### Requirements:

[](#requirements)

Linux, PHP 7.x, JRE 11

### Composer install:

[](#composer-install)

Install the lib via composer:

```
composer require merlinthemagic/mtm-signal-api

```

### Manual install:

[](#manual-install)

If you prefer you can simply download the 3 packages separately and include their autoloaders in yur project.

```
require_once "/path/to/mtm-utilities/Enable.php";
require_once "/path/to/mtm-fs/Enable.php";
require_once "/path/to/mtm-signal-api/Enable.php";

```

### Post install:

[](#post-install)

You must make the signal-cli binary executable:

```
chmod +x /path/to/mtm-signal-api/Vendors/SignalCli/bin/signal-cli

```

Quick start:
------------

[](#quick-start)

### Get a Client:

[](#get-a-client)

```
//Secure the data directory you will be using, private keys and passphrases are stored in plaintext
//make sure the folder is writable by your php user
$safePath		= "/path/to/secure/folder/";

//For testing on linux you can use the following:
//$safePath		= MTM_FS_TEMP_PATH. "sigtest";

$clientObj		= \MTM\SignalApi\Facts::getClients()->getSignalCli($safePath);

```

### Register To Existing Account:

[](#register-to-existing-account)

#### Link to a master account:

[](#link-to-a-master-account)

This will generate a URI that can be used to link the client as a slave on an existing master. This method will NOT disconnect any existing devices. It will simply allow a master device to approve the server as a linked account NOTE: This method is executed on the client object, not on any specific user. The generated user depends on the master device that accepts the link

```
$name		= "MyTestServer"; //shows up on master as identification for this client
$uri		= $clientObj->getDeviceLinkUri($name); //will throw on error

```

Now load the URI into your favorite QR generator or paste it to: (Change to allow 15% damage or you will get alot of mis reads) Then scan the QR code with a master device. Voila the server has a new linked user account that can send and receive messages

#### Accept slave link request:

[](#accept-slave-link-request)

This will accept a request to link from a slave. This method will NOT disconnect any existing devices. It will simply allow a slave device to become a linked account of the master account that approves the request NOTE: This method is executed on the user object. The slave user depends on who generate the uri

```
$uri		= "tsdevice:/?uuid=BBm...";
$userObj->linkDeviceByUri($uri); //will throw on error

```

### Register New Account:

[](#register-new-account)

#### Register via Captcha:

[](#register-via-captcha)

WARNING! This method will disconnect any existing devices from the phone number. You will be taking over the account, not linking a new device

Goto:

Complete the Captcha, hit "F12" to open developer tools. Right click the link in the console that starts with: "signalcaptcha://" Copy the link address so you can paste it to the register method below

```
$captcha		= "signalcaptcha://03ADsBq82yYFHDEA.....";
$userObj->registerByCaptcha($captcha); //will throw on error

```

You will receive an SMS code on your device, use that to run the next step of verification

#### Register via Voice:

[](#register-via-voice)

```
$userObj->registerByVoice();

```

#### Verify via SMS code:

[](#verify-via-sms-code)

```
$code			= "234568";
$userObj->verifyBySmsCode($code); //will throw on error

```

#### Verify via Voice code:

[](#verify-via-voice-code)

```
$code			= "863457";
$userObj->verifyByVoiceCode($code); //will throw on error

```

### Use the client:

[](#use-the-client)

#### Start by getting a user to work with:

[](#start-by-getting-a-user-to-work-with)

```
$phoneNumber	= "+12134567890";
$userObj	= $clientObj->getUser($phoneNumber);

```

#### Is a phone number registered:

[](#is-a-phone-number-registered)

```
$nbr		= "+13106545322";
$bool		= $userObj->isPhoneRegistered($nbr);

```

### Send message:

[](#send-message)

#### Text From user to phone number:

[](#text-from-user-to-phone-number)

```
$toNbr			= "+13109981100";
$msg			= "Hi Mom,\nPlease buy food, im so hungry!\nThx";
$timeStamp		= $userObj->sendText($toNbr, $msg);

```

#### Text From user to contact:

[](#text-from-user-to-contact)

```
$msg			= "Hi Baby,\nPlease buy food, im so hungry!\nThx";
$timeStamp		= $contactObj->sendText($msg);

```

#### Text From user to group:

[](#text-from-user-to-group)

```
$msg			= "Hi Parents,\nPlease buy food, im so hungry!\nThx";
$timeStamp		= $groupObj->sendText($msg);

```

#### Receive pending messages for a phone number:

[](#receive-pending-messages-for-a-phone-number)

```
//return array of message objects
$msgObjs		= $userObj->receive(); //will throw on error
foreach ($msgObjs as $msgObj) {
	if ($msgObj->getType() == "DataMessage") {
			echo $msgObj->getMessage()."";
	} elseif ($msgObj->getType() == "ReceiptMessage") {
			echo $msgObj->getWhen()."";
	}
}

```

### Contacts:

[](#contacts)

#### Get Contacts:

[](#get-contacts)

```
//return array of Contact objs
$array			= $userObj->getContacts(); //will throw on error

```

#### Get Contact By Username:

[](#get-contact-by-username)

```
//return contact obj, null or throws
$username		= "+13109997765";
$throw			= false;
$contactObj	= $userObj->getContactByUsername($username, $throw);

```

### Groups:

[](#groups)

#### Get Groups:

[](#get-groups)

```
//return array of Group objs
$array			= $userObj->getGroups(); //will throw on error

```

#### Get Group By ID:

[](#get-group-by-id)

```
//return group obj, null or throws
$id				= "efefekneef....";
$throw			= false;
$groupObj		= $userObj->getGroupById($id, $throw);

```

#### Create Group:

[](#create-group)

```
//return group obj
$name				= "My Group";
$groupObj			= $userObj->createGroups($name); //will throw on error

```

#### Set Group Name:

[](#set-group-name)

```
//return group obj
$name				= "My New Group Name";
$groupObj->setName($name);

```

#### Set Group Edit detail permission:

[](#set-group-edit-detail-permission)

```
$adminOnly				= true; //true or false
$groupObj->setEditDetailAdminOnly($adminOnly);

```

#### Set Group Add members permission:

[](#set-group-add-members-permission)

```
$adminOnly				= true; //true or false
$groupObj->setAddMemberAdminOnly($adminOnly);

```

#### Set Group Add members permission:

[](#set-group-add-members-permission-1)

```
$enabled			= true; //true or false
$withApproval		= true; //true or false
$groupObj->setLinkState($enabled, $withApproval);

```

#### Add Member to group:

[](#add-member-to-group)

```
$contactObj	= $userObj->getContactByUsername("+13109997765");
$groupObj->addMember($contactObj);

```

#### Remove Member from group:

[](#remove-member-from-group)

```
$contactObj	= $userObj->getContactByUsername("+13109997765");
$groupObj->removeMember($contactObj);

```

#### Get Group Members:

[](#get-group-members)

```
//Does not return user self. Use $groupObj->getIsMember() to determine user membership

//return array of Contact objs
$array		= $groupObj->getMembers();

```

#### Add Admin to group:

[](#add-admin-to-group)

```
$contactObj	= $userObj->getContactByUsername("+13109997765");
$groupObj->addAdmin($contactObj);

```

#### Remove Admin from group:

[](#remove-admin-from-group)

```
$contactObj	= $userObj->getContactByUsername("+13109997765");
$groupObj->removeAdmin($contactObj);

```

#### Get Group Admins:

[](#get-group-admins)

```
//Does not return user self. Use $groupObj->getIsAdmin() to determine user is admin

//return array of Contact objs
$array		= $groupObj->getAdmins();

```

#### Identities:

[](#identities)

#### Get Identities (not-ready):

[](#get-identities-not-ready)

```
//return array of identity objects
$array			= $userObj->getIdentities(); //will throw on error

```

#### Devices:

[](#devices)

#### Get Devices (not-ready):

[](#get-devices-not-ready)

```
//return array of device objects
$array			= $userObj->getDevices(); //will throw on error

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8021715?v=4)[Martin Peter Madsen](/maintainers/merlinthemagic)[@merlinthemagic](https://github.com/merlinthemagic)

---

Top Contributors

[![merlinthemagic](https://avatars.githubusercontent.com/u/8021715?v=4)](https://github.com/merlinthemagic "merlinthemagic (22 commits)")

### Embed Badge

![Health badge](/badges/merlinthemagic-mtm-signal-api/health.svg)

```
[![Health](https://phpackages.com/badges/merlinthemagic-mtm-signal-api/health.svg)](https://phpackages.com/packages/merlinthemagic-mtm-signal-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
