Download the PHP package kainiklas/laravel-strict-mode without Composer
On this page you can find all versions of the php package kainiklas/laravel-strict-mode. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kainiklas/laravel-strict-mode
More information about kainiklas/laravel-strict-mode
Files in kainiklas/laravel-strict-mode
Package laravel-strict-mode
Short Description Laravel Package to Enable Eloquent 'Strict Mode' and Further Safety Methods.
License MIT
Homepage https://github.com/kainiklas/laravel-strict-mode
Informations about the package laravel-strict-mode
Laravel Package to Enable Eloquent "Strict Mode" and Further Safety Methods
Enables the following configurable eloquent "strict mode" features:
- Prevent Lazy Loading (N+1)
- Non-production: Throws an
Illuminate\Database\LazyLoadingViolationException
exception - Production: Writes a warning into the logs
- Non-production: Throws an
- Prevent defaulting to NULL when using a model's attribute that hasn't been fetched from the DB or doesn't exist on the model
- Throws an
Illuminate\Database\Eloquent\MissingAttributeException
exception (all environments) - Alternatively: You can set the config to write a warning to the log
- Throws an
- Prevent loosing attributes when creating or updating models because of missing attributes in the $fillable array
- Throws an
Illuminate\Database\Eloquent\MassAssignmentException
exception (all environments) - Alternatively: You can set the config to write a warning to the log
- Throws an
Enables the following configurable safety methods:
- Long-running command monitoring
- Writes a warning into the logs including the command name, user and duration which took longer than the specified threshold (default: 5000ms)
- Long-running requests monitoring
- Writes a warning into the logs including the request url, user and duration which took longer than the specified threshold (default: 5000ms)
- Long-running single DB query monitoring
- Writes an info into the logs including the SQL query and duration which took longer than the specified threshold (default: 1000ms)
- Long-running DB connection monitoring
- Writes an info into the logs including the DB connection name which took longer than the specified threshold (default: 2000ms)
- Memory Heap Size monitoring
- Writes a warning into the logs including when the memory heap size exceeds the specified threshold (default: 50MB)
Installation
Laravel Version ^10.0 required.
You can install the package via composer:
Optionally, you can publish the config file.
You can influence the behaviour with environment variables.
This is the contents of the published config file.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Acknowledgements
This package is based on the following article:
Credits
- Kai Niklas
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-strict-mode with dependencies
spatie/laravel-package-tools Version ^1.14
illuminate/contracts Version ^10.0