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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners