[EasyWeChat](https://www.easywechat.com/) is an open source WeChat SDK (not WeChat official SDK).
> If you are using Swoole 4.7.0 and above, and have the native curl option turned on, you may not follow this document.
> Because the component uses `Curl` by default, we need to modify the corresponding `GuzzleClient` as a coroutine client, or modify the constant [SWOOLE_HOOK_FLAGS](/zh-cn/coroutine?id=swoole-runtime-hook-level)
## replace `Handler`
The following takes the public account as an example,
`EasyWeChat` is designed for `PHP-FPM` architecture, so it needs to be modified in some places to be used under Hyperf. Let's take the payment callback as an example to explain.
1.`EasyWeChat` comes with `XML` parsing, so we can get the original `XML`.
$request = new Request($get, $post, [], $cookie, $files, $server, $xml);
$request->headers = new HeaderBag($this->request->getHeaders());
$app->rebind('request', $request);
// Do something...
```
3. Server Configuration
If you need to use the server configuration function of the WeChat public platform, you can use the following code.
> The following `$response` is `Symfony\Component\HttpFoundation\Response` not `Hyperf\HttpMessage\Server\Response`
> So just return the `Body` content directly to pass WeChat verification.
```php
$response = $app->server->serve();
return $response->getContent();
```
## How to replace the cache
`EasyWeChat` uses `file cache` by default, but the actual scenario is that `Redis` cache is mostly used, so this can be replaced with the `hyperf/cache` cache component provided by `Hyperf`, if you do not currently install this component, please execute `composer Introduced by require hyperf/cache`, the usage example is as follows: