Download the PHP package imamnc/efihub-client without Composer

On this page you can find all versions of the php package imamnc/efihub-client. 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 efihub-client

EFIHUB

EFIHUB PHP/Laravel Client

A modern SDK to integrate with the EFIHUB platform using the OAuth 2.0 Client Credentials flow.

packagist version license author

Introduction

EFIHUB client for Laravel/PHP that authenticates using OAuth 2.0 Client Credentials and exposes:

Designed for server-side apps only—do not expose your client secret to browsers.


Table of Contents


Getting Started

Installation

Install the package via Composer:

Framework Setup

Laravel

Supports Laravel 7 through 13.

Auto-discovery is enabled. Optionally publish the config file:

Lumen 7 (Illuminate 7.30.4)

Register the service provider in bootstrap/app.php:

Enable and load the package config:

Copy the config file manually to config/efihub.php (Lumen does not support vendor:publish).

To use the Facade, enable facades and add an alias:

Environment Variables

Add the following to your .env file:

These map to config/efihub.php keys: client_id, client_secret, token_url, api_base_url.

Authentication

The client uses the OAuth 2.0 Client Credentials flow automatically:


HTTP Client

The base client handles authentication and exposes standard HTTP verbs. Use it directly for any EFIHUB API endpoint, or use the higher-level Modules for specific services.

Basic Usage

Dependency Injection


Modules

All modules are accessed via the Efihub Facade (e.g. Efihub::storage(), Efihub::whatsapp()).


Storage module

Upload files and manage them on the EFIHUB storage service.

Methods

Efihub::storage() returns Efihub\Modules\StorageClient with:

upload() accepts a Laravel/Symfony UploadedFile, a string path, or raw file contents. End $path with / to let the server auto-generate the filename.

Usage

Other helpers:

Endpoints


AI module

Generate text or images using EFIHUB AI endpoints with optional file attachments.

Methods

Efihub::ai() returns Efihub\Modules\AIClient with:

Supported attachment formats:

Usage

Attachment examples

Endpoints


WebSocket module

Dispatch real-time events to channels from a server-side listener or job.

Methods

Efihub::socket() returns Efihub\Modules\WebsocketClient with:

Usage

Endpoint


SSO module

Centralized login flow: generate an authorization URL, redirect the user, then exchange the redirect_token for user data.

Methods

Efihub::sso() returns Efihub\Modules\SSOClient with:

Usage

Step 1 — Redirect the user to EFIHUB login:

Step 2 — Handle the callback and fetch user data:

Endpoints

Security enhancements like state / nonce can be layered externally; ensure you bind the session before redirecting.


WhatsApp module

Manage WhatsApp agents and send messages (text or with attachments) to individual recipients or groups.

Methods

Efihub::whatsapp() returns Efihub\Modules\WhatsappClient with:

Agent management

Method Returns Description
agents() array List all registered agents/sessions. Empty array on failure.
agentQR(string $agentCode) string\|null QR code as image/png;base64, or null on failure.
agentStatus(string $agentCode) string\|null 'connected' or 'disconnected', or null on failure.
agentStart(string $agentCode) bool Start a WhatsApp agent session. Returns true on success.
agentRestart(string $agentCode) bool Restart a WhatsApp agent session. Returns true on success.
agentTerminate(string $agentCode) bool Terminate a WhatsApp agent session. Returns true on success.
checkPhoneNumber(string $agentCode, string $number) bool true if the number is a valid WhatsApp user.

Messaging

Method Returns Description
sendMessage(string $sender, string $to, string $message, ?string $ref_id, ?string $ref_url, ?bool $delay = true) bool Send a text message to a single recipient.
sendGroupMessage(string $sender, string $to, string $message, ?string $ref_id, ?string $ref_url, ?bool $delay = true) bool Send a text message to a group.
sendAttachment(string $sender, string $to, string $message, mixed $attachment, ?string $ref_id, ?string $ref_url, ?bool $delay = true) bool Send a message with a file attachment to a single recipient.
sendGroupAttachment(string $sender, string $to, string $message, mixed $attachment, ?string $ref_id, ?string $ref_url, ?bool $delay = true) bool Send a message with a file attachment to a group.
getMessages(string $agentCode, string $phone, int $limit = 10) array Retrieve recent messages for an agent and phone number.
downloadMedia(string $agentCode, string $phone, string $messageId) object\|null Download media attachment from a specific message.

All message methods return true on HTTP success (2xx), false otherwise. The getMessages() method returns an array of messages or empty array on failure.

The WhatsApp client also normalizes phone numbers for phone-based methods such as checkPhoneNumber(), getMessages(), and downloadMedia().

Agent management

Sending messages

Attachments

Supported file spec formats:

Format Example
Path string '/path/to/file.pdf'
Path array with custom name ['path' => '/path/to/file.pdf', 'filename' => 'custom.pdf', 'headers' => [...]]
Raw contents ['contents' => $binary, 'filename' => 'name.ext', 'headers' => [...]]
Multiple files (array of specs) ['/path/a.jpg', '/path/b.jpg']

Reference metadata

All four send methods accept optional $ref_id and $ref_url parameters to correlate outbound messages with internal entities (orders, tickets, etc.):

Retrieving messages

Error inspection

The helpers only return bool. For full error details, use the base HTTP client directly:

Phone number normalization

All phone-based methods (checkPhoneNumber, sendMessage, sendGroupMessage, sendAttachment, sendGroupAttachment, getMessages, downloadMedia) automatically normalize phone numbers to the international format (62xxxxxxxxxx for Indonesia). You may pass numbers in any common format:

Endpoints

Method Endpoint
agents() GET /whatsapp/sessions
agentQR() GET /whatsapp/session/qrcode/{agentCode}
agentStatus() GET /whatsapp/session/status/{agentCode}
agentStart() POST /whatsapp/session/start/{agentCode}
agentRestart() POST /whatsapp/session/restart/{agentCode}
agentTerminate() POST /whatsapp/session/terminate/{agentCode}
checkPhoneNumber() GET /whatsapp/user/exists/{agentCode}/{number}
sendMessage() POST /whatsapp/message
sendGroupMessage() POST /whatsapp/message/group
sendAttachment() POST /whatsapp/message/attachment
sendGroupAttachment() POST /whatsapp/message/group/attachment
getMessages() GET /whatsapp/messages/{agentCode}/{phone}/{limit}
downloadMedia() GET /whatsapp/message/download/{agentCode}/{phone}/{messageId}

Adjust paths if your EFIHUB deployment customizes routing.


License & Author

MIT © Imam Nurcholis. See LICENSE.


All versions of efihub-client with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
illuminate/support Version ^7.30.4|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/cache Version ^7.30.4|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^7.30.4|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^6.5|^7.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 imamnc/efihub-client contains the following files

Loading the files please wait ...