Skip to content

Commit af393ba

Browse files
committed
Update Readme
1 parent 882ef24 commit af393ba

File tree

1 file changed

+21
-39
lines changed

1 file changed

+21
-39
lines changed

README.md

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
11
PHP Debug Mode Enabler
22
======================
3-
> not only for Tracy debugger
43

5-
Safe and clean way to manage Debug Mode in your app by specific environment and/or manually in app.
6-
Package provide secure way to temporary switch Debug Mode of your App at any environment.
4+
Safe and clean way to manage Debug Mode in your app by specific environment and/or manually in App.
5+
Package automatically detects development environments and provide secure way to temporary switch Debug Mode of your App
6+
at any environment.
77

88
## Features
99
Package allows your app to switch to Debug Mode:
1010
- automatically on localhost's environment by IP,
1111
- semi-automatically on any environment where you set `APP_DEBUG` environment variable (useful for Docker dev-stack),
12-
- allows you to switch (force turn-on or turn-off) Debug Mode manually.
12+
- semi-automatically disable Debug mode on any environment where you set `app-debug-mode` cookie variable (useful for
13+
tests and similar cases),
14+
- manually enable/disable (force turn-on or turn-off) Debug Mode.
1315

14-
> NOTE: Package is NOT provide any Debug tools directly – it only gives the app whether to switch to debug mode.
16+
**NOTE:** Package is NOT provide any Debug tools directly – it only gives the app whether to switch to debug mode.
17+
18+
Package is optimized for invoking in very early lifecycle phase of your App and
19+
20+
## Requirements
21+
Package is requires:
22+
23+
- PHP version at least 7.3
24+
- Temporary directory with writable access
1525

1626
## Installation
1727
```shell
1828
composer require redbitcz/debug-mode-enabler
1929
```
2030

21-
## Requirements
22-
Package is requires PHP version at least 7.3 and temporary directory with writable access.
23-
2431
## Using
2532
Anywhere in your app you can determine if app is running in Debug mode by simple code:
2633
```php
27-
$detector = new \Redbitcz\DebugMode\Detector($tempDir);
28-
$debugMode = $detector->isDebugMode(); // boolean
34+
$debugMode = \Redbitcz\DebugMode\Detector::detect($tempDir); //bool
2935
```
30-
where `$tempDir` is required absolute path to temporary directory.
36+
where `$tempDir` is required path to temporary directory.
3137

3238
It returns `$debugMode` = `true` when is detected Debug environment or manually switched.
3339

3440
### Using with Nette
35-
In `\App\Bootstrap` class use package like this example:
41+
In Boostrap use package like this example:
3642
```php
3743
$tempDir = __DIR__ . '/../temp';
3844
$debugModeDetector = new \Redbitcz\DebugMode\Detector($tempDir);
@@ -58,10 +64,6 @@ environment:
5864
```
5965
6066
## Manually switch
61-
<p align="center">
62-
<img width="368" height="280" src="https://user-images.githubusercontent.com/1657322/78752208-f2354a00-7973-11ea-83ea-b2719e326dc8.png">
63-
</p>
64-
6567
**WARNING – DANGER ZONE:** Following feature allows to force Debug Mode on any environment, production including.
6668
Please use it with great caution only! Wrong use might cause to critical security issue! Before using Enabler's feature be
6769
aware your app is resistant to XSS, CSRF and similar attacks!
@@ -86,8 +88,8 @@ services:
8688
- Redbitcz\DebugMode\Enabler(%tempDir%)
8789
```
8890
89-
At most cases this example is creates second instance of `DebugModeEnabler` class because first one is already created
90-
internally with `DebugModeDetector` instance in `Bootstrap`.
91+
At most cases this example is creates second instance of `Enabler` class because first one is already created
92+
internally with `Detector` instance in `Bootstrap`.
9193

9294
To re-use already exists instance you can inject it to DI Container:
9395
```php
@@ -108,24 +110,4 @@ services:
108110
```
109111

110112
## License
111-
The MIT License (MIT)
112-
113-
Copyright (c) 2020 Redbit s.r.o., Jakub Bouček
114-
115-
Permission is hereby granted, free of charge, to any person obtaining a copy
116-
of this software and associated documentation files (the "Software"), to deal
117-
in the Software without restriction, including without limitation the rights
118-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
119-
copies of the Software, and to permit persons to whom the Software is
120-
furnished to do so, subject to the following conditions:
121-
122-
The above copyright notice and this permission notice shall be included in all
123-
copies or substantial portions of the Software.
124-
125-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
126-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
127-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
128-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
129-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
130-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
131-
SOFTWARE.
113+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

0 commit comments

Comments
 (0)