Source: www.amitmerchant.com

How to use Collections outside of Laravel
The one feature of Laravel I truly admire is the https://laravel.com/docs/8.x/collections. Essentially, collections provide a fluent, convenient wrapper for working with arrays of data.

But let’s say, you’re not using Laravel and you still want to use Collections in your non-Laravel PHP projects, how would you do it?

To use Laravel collections in your non-Laravel projects, it’s a pre-requisite that you’re using https://getcomposer.org/ in your project.

You can now start using the https://laravel.com/docs/8.x/collections just like how you would use it in your Laravel project.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners