Download the PHP package tritech/threadwire-laravel without Composer

On this page you can find all versions of the php package tritech/threadwire-laravel. 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 threadwire-laravel

Threadwire for Laravel

Tests Latest version Downloads

The official Laravel package for Threadwire, the WhatsApp API that keeps your numbers safe.

Requires PHP 8.2+ and Laravel 12 or 13, and a Threadwire account (7 days free).

Install

Laravel finds the service provider and the Threadwire facade on its own.

Configure

In .env:

To change more, publish the config: php artisan vendor:publish --tag=threadwire-config.

Send

Each number has an id (instance_id), shown on its page in your panel. Send to a phone in international format, or to a group's or channel's chat_id:

Read and cancel:

Poll for events instead of a webhook

No public address for a webhook (a server behind a firewall, a script on a schedule), or catching up after downtime? Poll: you get the same events, in the same shape, oldest first. Keep next_after and pass it back; ask again at once while has_more is true, otherwise wait a few seconds. An event your webhook also got has the same id, so skip ids you have handled.

WhatsApp OTP

Prove someone holds a WhatsApp number, for a sign-up or a password-free sign-in. Use the link unless you must send the code yourself: the person sends you the code, so your number only replies (the safest message there is, with no night hours or daily limit).

Broadcasts

One message to many people who opted in: people who wrote to your number. Each gets their own message, one at a time, in daytime, with an opt-out line added, and the broadcast pauses by itself if WhatsApp warns the number or too many people reply STOP. A list is filtered to people who wrote; left_out says who was not, and why.

Listen for Threadwire\Events\BroadcastPaused (with reason.code and reason.text) and Threadwire\Events\BroadcastCompleted.

Anything else in the API: Threadwire::json('get', 'instances/'.$numberId.'/groups'), or Threadwire::call(...) for the raw response. Single items come back as the array under data; lists come back whole (data, links, meta). The full reference is at https://threadwire.tri-tech.net/docs/api.

When Threadwire says no

A refusal throws a Threadwire\Exceptions\ThreadwireException. Its message is Threadwire's own reason, in plain words, fit to show or log. A subclass names the common cases:

Exception Status What to do
ValidationException 422 Fix the request; $e->errors says what was wrong with each field
ConflictException 409 Not possible right now (the number is not connected, a message can no longer be cancelled); $e->retryAfter when it is worth trying again
RateLimitedException 429 A limit was reached; wait $e->retryAfter seconds. The message says which limit
AuthenticationException 401 The key is missing, wrong or revoked
ForbiddenException 403 The key may not do this, or the account is suspended
NotFoundException 404 No such number or message, or not one this key reaches

A network failure is Laravel's own Illuminate\Http\Client\ConnectionException. Nothing is retried for you: retry a send only with the same idempotency_key, so it can never go twice.

Protecting your numbers

WhatsApp bans numbers that behave like bots, so Threadwire sends the way a person would, and some messages wait or are refused:

Receive webhooks

Set your webhook URL in the Threadwire panel (Webhooks → Set webhook URL) to https://your-app.example/threadwire/webhook. The package registers that route, outside the web group (no session, no CSRF token), and lets through only events signed with your secret within the last 5 minutes; anything else gets 401.

Each event is dispatched as a Laravel event: Threadwire\Events\WebhookReceived for every event, and one for its type:

Webhook Laravel event
message.received MessageReceived
message.sent_from_phone MessageSentFromPhone
message.status MessageStatusUpdated
message.edited, message.deleted MessageEdited, MessageDeleted
message.poll_vote, message.reaction PollVoted, ReactionReceived
group.message, group.update GroupMessageReceived, GroupUpdated
call.received, call.rejected CallReceived, CallRejected
instance.status InstanceStatusUpdated
webhook.test WebhookTested

Every one has id, type, createdAt, data (for message events, the message as the API shows it) and payload (the whole event). A type added later reaches WebhookReceived.

Testing your app

Fake Threadwire with Laravel's own Http::fake():

Developing the package (maintainers)

The webhook tests sign requests with a copy of Threadwire's own signing code, and Threadwire's test suite verifies its real signatures with this package's WebhookSignature, so the two cannot drift apart.

License

MIT


All versions of threadwire-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
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 tritech/threadwire-laravel contains the following files

Loading the files please wait ...