alphasnow / utils
PHP utils package
0.0.1
2022-10-26 01:27 UTC
Requires
- php: >=7.2
- ext-mbstring: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.4
- php-coveralls/php-coveralls: ^2.5
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^8.5.23
README
Requirement
- PHP >= 7.2
Install
composer require alphasnow/utils
Example
use AlphaSnow\Utils\ListTree; $list = [ ['id' => 1, 'pid' => 0, 'name' => 'node1'], ['id' => 2, 'pid' => 1, 'name' => 'node2'], ['id' => 3, 'pid' => 2, 'name' => 'node3'], ]; $tree = ListTree::listToTree($list); /* [ ['id' => 1, 'pid' => 0, 'name' => 'node1', '_child' => [ ['id' => 2, 'pid' => 1, 'name' => 'node2', '_child' => [ ['id' => 3, 'pid' => 2, 'name' => 'node3'] ]] ]], ]; */ $name = snake_name('ArticleCategory') // article_category
Credits
License
MIT License. See the LICENSE file.