https://github.com/ostark/craft-mute-deprecations
Mute Craft deprecations
https://github.com/ostark/craft-mute-deprecations
craftcms example yii2 yii2-extension
Last synced: about 2 months ago
JSON representation
Mute Craft deprecations
- Host: GitHub
- URL: https://github.com/ostark/craft-mute-deprecations
- Owner: ostark
- Created: 2018-04-05T19:47:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-05T22:49:07.000Z (over 8 years ago)
- Last Synced: 2025-10-07T02:55:40.133Z (9 months ago)
- Topics: craftcms, example, yii2, yii2-extension
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mute Craft deprecations in production
When migrating a site from Craft 2 to Craft 3, you will notice things [changed in the templates](https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions). Twig tags got renamed and variable access is slightly different - they old way is usually still supported, but is marked as "deprecated".
This extension prevents Craft from logging deprecation errors if `'devMode' => false` in `config/general.php`.
It speeds up your site by reducing overhead of tracing the code and logging to the database.
**Notice: Do not simply mute deprecation errors, remove them as soon as possible.**
## Why?
The benefits of this package are very limited. It is rather an example of how to use a Yii extension with Craft instead of a Plugin.
With this `extra` option in the `composer.json` you hook into Yii's bootstrapping process:
```
"extra": {
"bootstrap": "ostark\\MuteDeprecations\\Bootstrap"
}
```
In the [Bootstrap class](https://github.com/ostark/craft-mute-deprecations/blob/master/src/Bootstrap.php), you learn how to access the `Craft::$app` instance, to use services and to swap out a Craft core component from the container.
## Links
* https://www.yiiframework.com/doc/guide/2.0/en/structure-extensions
* https://docs.craftcms.com/v3/plugin-intro.html
## Install
Require the package:
```
composer require ostark/craft-mute-deprecations
```