spaf/yii2-simputils

Yii2 extension wrap for php-simputils, some useful wraps that improve usage

0.1.0 2021-09-18 21:04 UTC

This package is auto-updated.

Last update: 2024-06-16 14:16:03 UTC


README

yii2-simputils

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.