Download the PHP package lss/threema-gateway without Composer

On this page you can find all versions of the php package lss/threema-gateway. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package threema-gateway

Threema Gateway PHP SDK

This is an unofficial wrapper for the Threema Gateway API.

You have four other alternatives

Why build another one?

In summary, what is new

Versioning

The official .zip is 1.1.7 as at time of writing (August 2018). Rugk version is 1.2.0 (August 2018). This repo is a clone of the 1.2.0 master. To reduce potential for confusion, this repo is named threema-gateway instead of threema-msgapi-sdk. It starts from 2.0.0 because of breaking changes. See CHANGELOG.md for details

The contributors of this repository are not affiliated with Threema or the Threema GmbH.

Installation

If you want to check whether your server meets the requirements and everything is configured properly, run vendor/bin/threema-gateway without any parameters on the console. It should show a list of commands if it is working, or an error message if not.

SDK usage

Creating a connection

There is only one encryption method and one HttpDriver (currently) available. If you want to change connection settings or provide alternate drivers or mock for testing, pass them in to the ConnectionFactory constructor

Sending a text message to a Threema ID (Simple Mode)

The message is encrypted on the Threema Gateway server.

Sending a text message to a Threema ID (E2E Mode)

The message is encrypted locally before sending to Threema Gateway.

Sending a file message to a Threema ID (E2E Mode)

Technical notes

Much of the communication with the Threema Gateway server is in binary. But not all of it. Sometimes you get a hex version of the binary value back. The PHP wrapper attempts to hide all this from you: pass all values to $connection as hex encoded binary strings (use $encryptor->bin2hex()). All values coming back are hex encoded binary strings.

The $encryptor mostly requires and returns binary strings as parameters, but for normal use of the api you will not need the encryptor so will not need to worry about it. See the console commands for examples if unsure. Most parameters now have phpDoc comments to tell you if they are binary strings or hex strings.

tl;dr: expect to see and use hex

Console client usage

Run

for a list of commands and their options.

Store your api secret, public and private keys in a file called default.key in the current working directory. See default.key.sample for a template. This will save you a lot of typing and keep your secrets off the command line. Do not check your default.key file into version control.

To generate a new key pair,

which will print the keys to the console. Copy and paste those to your default.key file. You also need this to register your ID on Threema Gateway.

A good smoke test to see if everything is working right is

which should show you the number of credits remaining in your account or an error message on failure.

Contributing

Your pull requests are welcome here. Please follow the informal coding style that already exists (which tries to stay close to Threema's original). See the notes at the top of this readme for caveats: this is a fork of an unofficial fork of an unsupported api. The goals of this fork are quite different to the others, so maybe think about where your contribution will be most useful.

The original code did not come with a lot of tests. All new code should be covered by phpUnit tests. To run the tests,

or

Also check with phpstan, which must be green (zero errors) at maximum level.

To Do

Other platforms (Java and Python)

All repositories on GitHub are no longer maintained by the Threema GmbH. However, the community has forked the repositories of all platforms and they are now maintained unofficially.

You can find the Java repository at simmac/threema-msgapi-sdk-java
and the Python repository at lgrahl/threema-msgapi-sdk-python.


All versions of threema-gateway with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-json Version *
ext-curl Version *
ext-sodium Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lss/threema-gateway contains the following files

Loading the files please wait ....