https://github.com/hectorqin/hyperf-fastloader
Make hyperf2.0 load faster
https://github.com/hectorqin/hyperf-fastloader
hyperf hyperf2 php
Last synced: 2 months ago
JSON representation
Make hyperf2.0 load faster
- Host: GitHub
- URL: https://github.com/hectorqin/hyperf-fastloader
- Owner: hectorqin
- Created: 2020-06-23T01:35:10.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-02T12:27:51.000Z (almost 5 years ago)
- Last Synced: 2025-02-09T07:26:58.501Z (4 months ago)
- Topics: hyperf, hyperf2, php
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hyperf-fastloader
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).
```bash
composer dump-autoload -o
```- Replace `Hyperf\Di\ClassLoader::init();` with `Hector\FastLoader\ClassLoader::init();`
- Add the configure below to the config file `config/config.php`
```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`
```env
SCAN_CACHE_VENDOR_ONLY=true
```- Turn off `scan_cacheable`