Download the PHP package xaamin/whatsapi without Composer
On this page you can find all versions of the php package xaamin/whatsapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package whatsapi
END OF SUPPORT
See https://github.com/xaamin/whatsapi/issues/38
Whatsapi
Wrapper for whatsapp/chat-api, that allows us send messages through WhatsApp. Thanks guys.
Installation
Non Laravel users
If you're not a Laravel user you only need to run the composer require command in order to install the needed package.
Laravel users
Assuming you already have composer installed on your system, install a new Laravel project into whatsapidemo
folder
Ensure that you set webserver to use whatsapidemo/public
as it's webroot. Now, if you visit http://localhost (or whatever domain name you are using) you should see a nice Laravel welcome message.
Change into your new whatsapidemo
folder.
Require the needed package.
If you get [InvalidArgumentException] Could not find package xaamin/whatsapi at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
you must add these lines to your composer.json an then re-run previous command.
We tell Laravel that there is a Whatsapi ServiceProvider. At the end of config/app.php
file, in the providers array, add:
Finally, Into the config/app.php
file, add to aliases array each of these lines
Configuration
Non Laravel users
If you're using another Framework, different from Laravel, you must put manually the config file Config/config.php
on the right path.
Now, we tell Whatsapi about the config values.
By default, the native implementation session use the $_SESSION
global var, you can override this providing a instance that implements the contract Xaamin\Whatsapi\Sessions\SessionInterface
.
Laravel users
We need to publish the config file that will allow you to very easily add all your account numbers.
Now everything has been installed, you just need to add your Whatsapp account details into the config file. There will now be a personal config file created for you in whatsapidemo/config/whatsapi.php
. Open this file and edit the details with your account info. Once saved, you're good to use the API!
Usage
Note: You must create the data storage path specified in configuration file. The path must be writable for webserver.
Request registration code
When requesting the code, you can do it via SMS or voice call, in both cases you will receive a code like 123-456, that we will use for register the number.
Example response:
Registration
If you received the code like this 123-456 you should register like this '123456'
If everything went right, this should be the output:
See the entire registration process on https://github.com/WHAnonymous/Chat-API/wiki/WhatsAPI-Documentation#number-registration
Send messages
Check for new messages
Sync contacts
Example response
Missing methods
You can use all power of the whatsapp/chat-api getting and instance of Whatsprot
class. Read the whatsapp/chat-api wiki for available methods.
You can use on routes, cli... you got the idea.