Download the PHP package mistcheng/sowechat without Composer
On this page you can find all versions of the php package mistcheng/sowechat. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sowechat
Wechat(WeiXin) Web Api Based On Laravel PHP Framework
Features
7*24
hours no-end running,- easy to use, support sending/receiving multi type messages
- graceful system architecture, support
cross platform
development and flexible customextensions
- support
Restful Api
,async message processing
andmessage event broadcasting
- based on
Php
, the best language in The World! :)
System Architecture
- This System is composed of 3 independent components
- The
Middle
component is core of The System, doing qrcode scan & message listening; I do a lot of work for pupose of robust. Meantime, as a connector, it supports message-sending ability for theLeft
component, and pushs simple-formated message to theRight
component. Run commandphp artisan wechat:listen
to make it working.- The
Left
component is used for sending message, the user can send message to any friends in his code. classApp\Console\Commands\WechatSend
is a sample, run commandphp artisan wechat:send
to make it working.- The
Right
component is used for processing message, the user can do anything for the coming message. The jobApp\Jobs\ProcessWechatMessage
process each message into more formatted message(text,share,image,voice,file, etc). Next, It fires theApp\Events\WechatMessageEvent
event to the subscribers, who can do some custom things with the message. classApp\Listeners\SaveWechatMessageListener
is a sample that saving the message into the DB.Advantage
: The three components are 3 independent Process. this can grantee the non-ending running of theMiddle
part, at the same time, the user can do any extensions in theLeft
andRight
part without disturbing theMiddle
part.
Prerequisite
- php 5.6 or more
- php composer
- redis (optional)
- mysql (optional)
Usage
1. Installation
2. Configration
2.1 config/wechat.php
is wechat config file
2.2 Queue Configuration (Recommend database or redis, never use async)
In section
2.1
, the optionwechat.job.connection
should be configured in the fileconfig/database.php
.
2.2.1 if set wechat.job.connection
withdatabase
, the option database.connections.mysql
must be configured correctly
2.2.2 if set wechat.job.connection
withredis
, the option database.redis
should be configured properly.
2.3 Running
2.3.1 First time, init DB script
2.3.2 Run the Middle
component for new
There will be a new qrcode in the folder
storage/app/wechat
, use your wechat scaning it to login.
2.3.3 Run the Middle
component without re-login
Run the command without passing argument --new
2.3.4 Processing wechat message
See Job
App\Jobs\ProcessWechatMessage
and sample classApp\Listeners\SaveWechatMessageListener
for more detail.
2.3.5 Sending wechat message (Console)
See class
App\Console\Commands\WechatSend
for more detail.
2.3.6 Sending wechat message (Web Api)
When you call the api, you must start the web server. The easiest way is start a mini server with the command above. Also, you can deploy you code use
Apache
Nginx
etc
there has some examples, this will return a json response {'ret':0, 'message':'xxx'}
, success if the ret
equals 0
OpenSource
Statement
This software shall not be used for commercial purposes only
All versions of sowechat with dependencies
laravel/framework Version 5.3.*
predis/predis Version ~1.0
guzzlehttp/guzzle Version ~6.0
barryvdh/laravel-ide-helper Version ~2.2