Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jgravois's avatar

Add PHP Library to Laravel 5

I would like to add Dash (lodash for PHP @ https://packagist.org/packages/mpetrovich/dash) to Laravel 5 but there are no specific Laravel installation steps like other libraries.

Can I use Dash in Laravel or am I restricted to the core and Laravel-specific libraries?

0 likes
4 replies
zachleigh's avatar

You can use it but you may have to write your own service provider for it.

zachleigh's avatar

Im no expert when it comes to service providers, but it looks like you would only have to register the Dash class in the provider. Then you would have to register the provider and assign an alias in your Laravel project in config/app.php. I think that would do it, not 100% sure though. Check the docs for more about service providers.
http://laravel.com/docs/master/providers

jimmck's avatar

Hi,

Just composer require mpetrovich/dash

And you are good to go.

Its a Util library.

print Dash\Collection\map(array (1, 2, 3), function ($n) { return $n * 10; })[1];

Works fine. Basic Doc and info is here: https://packagist.org/packages/mpetrovich/dash

Your link was a 404

2 likes

Please or to participate in this conversation.