wechat.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. return [
  3. /*
  4. * 授权相关配置
  5. */
  6. 'auth' => [
  7. 'cache_prefix' => 'wechat_auth_state:',
  8. 'cache_ttl' => 600, // 10分钟
  9. 'default_scope' => 'snsapi_userinfo',
  10. ],
  11. /*
  12. * 默认配置,将会合并到各模块中
  13. */
  14. 'defaults' => [
  15. /*
  16. * 指定 API 调用返回结果的类型:array(default)/object/raw/自定义类名
  17. */
  18. 'response_type' => 'array',
  19. /*
  20. * 使用 Laravel 的缓存系统
  21. */
  22. 'use_laravel_cache' => true,
  23. /*
  24. * 日志配置
  25. */
  26. 'log' => [
  27. 'default' => 'single',
  28. 'channels' => [
  29. 'single' => [
  30. 'driver' => 'single',
  31. 'path' => storage_path('logs/wechat.log'),
  32. 'level' => 'debug',
  33. ],
  34. ],
  35. ],
  36. ],
  37. /*
  38. * 公众号
  39. */
  40. 'official_account' => [
  41. 'default' => [
  42. 'app_id' => env('WECHAT_OFFICIAL_ACCOUNT_APPID', ''), // AppID
  43. 'secret' => env('WECHAT_OFFICIAL_ACCOUNT_SECRET', ''), // AppSecret
  44. 'token' => env('WECHAT_OFFICIAL_ACCOUNT_TOKEN', ''), // Token
  45. 'aes_key' => env('WECHAT_OFFICIAL_ACCOUNT_AES_KEY', ''), // EncodingAESKey
  46. /**
  47. * OAuth 配置
  48. */
  49. 'oauth' => [
  50. 'scopes' => ['snsapi_userinfo'],
  51. 'callback' => env('WECHAT_OFFICIAL_ACCOUNT_OAUTH_CALLBACK', '/oauth_callback'),
  52. ],
  53. /**
  54. * 接口请求相关配置,超时时间等,具体可用参数请参考:
  55. * https://github.com/symfony/symfony/blob/5.3/src/Symfony/Contracts/HttpClient/HttpClientInterface.php
  56. */
  57. 'http' => [
  58. 'timeout' => 5.0,
  59. 'retry' => true,
  60. 'retry_delay' => 500,
  61. 'max_retries' => 1,
  62. ],
  63. ],
  64. ],
  65. ];