fenzland/laravel-helpers

Helper functions for laravel.
95 3
Install
composer require fenzland/laravel-helpers
Latest Version:1.0.0
PHP:>=7.0
License:MIT
Last Updated:Sep 27, 2017
Links: GitHub  ·  Packagist
Maintainer: Fenzland

Fenzland Laravel Helper

Some useful helper functions for laravel.

Usage

Step 1. Install with composer.

composer require fenzland/laravel-helpers

Step 2. Enjoy.

Functions

z()

If you dump something with dd(), the program will be terminated. Sometimes (or usually), that's not what we want. Instead of exit, z() will dump what you give and return it back. So you can dump values in your process without side effect.

/*
$foo->doSomething($bar->someObject->someValue());
/*/
z($foo->doSomething(z(z($bar->someObject)->someValue())));
//*/

routo()

Similar with route(), but smarter.

// Case 1: In page foo.bar.projects.index , call
routo('.show',[ 'project'=>$project, ]) === route('foo.bar.projects.show',[ 'project'=>$project, ]);

// Case 2: In page foo.bar.projects.show with param [ project=>$project, ]
routo('.edit') === route('foo.bar.projects.edit',[ 'project'=>$project, ]);

// Case 3: In page Foo:foo.foo.foo
routo(':bar') === route('Foo:bar');

array_transposition()

Transposition a matrix, whitch is an array of some array with same structure.

$fromArray= [
	'foo'=> [
		'foo1',
		'foo2',
		'foo3',
		'foo4',
	],
	'bar'=> [
		'bar1',
		'bar2',
		'bar3',
		'bar4',
	],
]
array_transposition($fromArray) === [
	[ 'foo'=>'foo1', 'bar'=>'bar1', ],
	[ 'foo'=>'foo2', 'bar'=>'bar2', ],
	[ 'foo'=>'foo3', 'bar'=>'bar3', ],
	[ 'foo'=>'foo4', 'bar'=>'bar4', ],
]

License

MIT license.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

631,580,251 9,707
laravel/framework

The Laravel Framework.

580,311,802 34,925
laravel/tinker

Powerful REPL for the Laravel framework.

489,754,436 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

404,034,618 608
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

384,821,166 4,658