hectorqin / hyperf-fastloader
Make hyperf2.0 load faster
v0.3.1
2020-07-02 12:27 UTC
Requires
- php: >=7.2
- ext-swoole: >=4.4
- hyperf/di: ~2.0.1
Requires (Dev)
- hyperf/config: ~2.0.1
- hyperf/framework: ~2.0.1
- swoft/swoole-ide-helper: dev-master
README
Make hyperf2.0 load faster by only caching file anotations in the vendor directory.
install
```bash
composer require hectorqin/hyperf-fastloader
```
usage
This component only take effect when the configure scan_cache_vendor_only
is turned on and the configure scan_cacheable
is turned off.
-
Init composer classMap (Very important! If you delete PHP class file in the app dirctory or add/remove composer packages, you need to run this command again).
composer dump-autoload -o
-
Replace
Hyperf\Di\ClassLoader::init();
withHector\FastLoader\ClassLoader::init();
-
Add the configure below to the config file
config/config.php
// is only caching file anotations in the vendor directory 'scan_cache_vendor_only' => env('SCAN_CACHE_VENDOR_ONLY', false),
-
Add the configure below to the env file
.env
SCAN_CACHE_VENDOR_ONLY=true
-
Turn off
scan_cacheable