When I wrap a regular object into a collection, the result is an associative array.
I would like to keep using it as an object.
$obj = (object) ['count'=>1, 'now'=>Carbon::now()];
dump($obj); // $obj->count = 1, $obj->now = Carbon {...}
$collection = collect($obj);
dump($collection); // unwanted: $collection['count'] = 1, $collection['now'] = Carbon {...}
In a similar question the offered solution is to json_encode/json_decode the $collection.
But that modifies the object and loses information (e.g. converts the now Carbon object to a string).
$collection = json_decode(collect($obj)->toJson());
dump($collection); // unwanted: $collection->count = 1, $collection->now = "2021-05-25T10:43:34.301505Z"
How can I wrap an object into a collection without turning it into an associative array?