PHP code example of mistcheng / sowechat
1. Go to this page and download the library: Download mistcheng/sowechat library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mistcheng / sowechat example snippets
return [
'debug' => env('WECHAT_DEBUG', false), // debug mode
'web_api' => [
'connect_timeout' => 30, // http request timeout
'max_attempts' => 10, // max request attempts in half minutes
],
'job' => [
'connection' => env('QUEUE_DRIVER', 'database'), // wehcat message queu engine, recommend database|redis
'queue' => env('JOB_QUEUE', 'default'), // queue name
],
];
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
],
'redis' => [
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
bash
cd sowechat
php artisan migrate
bash
php artisan wechat:listen --new
bash
php artisan wechat:listen
bash
php artisan queue:work
bash
php artisan wechat:send
bash
php artisan wechat:serve --port=your_port