use Doctrine\Common\Collections\ArrayCollection; // create a new collection $collection = new ArrayCollection(); // add items to the collection $collection->add('one'); $collection->add('two'); $collection->add('three'); // iterate over the collection foreach ($collection as $item) { echo $item . "\n"; } // filter the collection by a condition $filteredCollection = $collection->filter(function ($item) { return strlen($item) > 3; }); // sort the collection by a property $sortedCollection = $collection->matching( Criteria::create()->orderBy(['name' => 'ASC']) ); // group the collection by a property $groupedCollection = $collection->groupBy(function ($item) { return strlen($item); });As shown in the examples above, the `Collection` class provides methods like `add`, `filter`, `matching`, and `groupBy` to manipulate and work with arrays. These methods make it easy to handle PHP arrays in a more expressive and functional way. In conclusion, the `Collection` class is a utility class provided by the `doctrine/common` package that enables PHP developers to work with arrays in a more sophisticated and powerful way.