spaf / yii2-simputils
Yii2 extension wrap for php-simputils, some useful wraps that improve usage
Installs: 125
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 2
Type:yii2-extension
Requires
- php: >=8.0
- spaf/simputils: *
- yiisoft/yii2: ~2.0.43
This package is auto-updated.
Last update: 2024-12-16 15:26:02 UTC
README
Yii2 extension wrap for php-simputils, some useful wraps that improve usage
Current condition
This version is initial wrapper-library for usage with Yii2 framework.
Basically it implements just an improvement of VarDumper capabilities for "pd()" procedure. All other functionality will be added later.
P.S. This version I have developed just for myself. Because my php-simputils is not ready as well. But you are welcome to suggest things/functionality for both. Documentation will be improved as well.
Basic Usage
Install it through composer:
composer require spaf/yii2-simputils "*"
Add this to your yii2 config file for console.php
:
<?php $config = [ // ... 'bootstrap' => [ [ 'class' => 'spaf\yii\simputils\bootstrap\SimputilsBootstrap', 'isConsole' => true, ] ], // ... ];
And add this one for web.php
:
<?php $config = [ // ... 'bootstrap' => [ [ 'class' => 'spaf\yii\simputils\bootstrap\SimputilsBootstrap', ] ], // ... ];
And that's it! Now you can use the wrapped functionality (currently only pd()
procedure).
In your code you can use now:
<?php use function spaf\simputils\basic\pd; $myVar = [ 'key1' => 'value1', 'key2' => [ 'subkey1' => 'subvalue1', 'subkey2' => 12 ], ]; pd($myVar);
Important: You need to use normal pd()
procedure, this library does not redefine it, but adjust it's behaviour.