A buffer class to compose a raw bson_t struct could be useful. When dealing with large response documents, this class (when combined with PHPC-315) could allow users to decode only as much BSON (into PHP values) as they need and leave large arrays or embedded documents as raw BSON data.
At a glance, the class might have the following API:
- BsonBuffer::__construct($bson)
- BsonBuffer::toPHP(): mixed
- static BsonBuffer::fromPHP($value): BsonBuffer
Additionally, we should consider how this class could be used for a lazy array/document class that decodes BSON data as needed (perhaps related to PHPC-324).
- is related to
-
PHPC-315 Support explicit type mapping for top-level documents
- Closed
-
PHPC-324 Create a BSON document iterator class
- Closed
-
PHPC-311 Rename BSON from/toArray() methods to from/toPHP()
- Closed
- related to
-
PHPC-2214 Int64 Improvements
- Released
-
PHPC-2210 Fix direct copying of BSON data from Document and PackedArray objects
- Closed
-
PHPC-2211 php_phongo_bson_to_json() does not free intermediary result string
- Closed
-
PHPC-2222 PackedArray::fromPHP returns Document for root=bson type map
- Closed
-
PHPC-2216 BulkWrite::insert() does not generate _id for Document or PackedArray
- Closed
-
PHPC-2175 Add bson_validate API to classes modeling raw BSON data
- Backlog
-
PHPLIB-1122 Support Document and PackedArray objects in public APIs
- Closed
-
PHPC-2178 Improve test coverage of type map behavior for objects implementing Persistable
- Backlog
-
PHPLIB-1137 Prohibit PackedArray objects where a document type is expected
- Closed