I need to use the laravel api ressources to transform some attributes but i don't know how it affects the speed of the request especially if we have a large database.
CodePudding user response:
Laravel's resource classes allow you to expressively and easily transform your models and model collections into JSON. It should not make your app any slower than it already is. If your app is slower you can do the following.
- Edger Load relations
- Try to get large data in chunks using laravel's
Chunk()
method - Indexing In Database frequent queries
- Cache where real-time data is not required
- Use Queue when required
- Cache Config, Routes
- Limit using third party packages
- JIT Compiler
- Optimize Composer Autoload
- Classmap optimization