Repository navigation
class_dicom 2.0.0
Complete clean-room rewrite for modern PHP. New namespaced, fully-typed API with exception-based error handling, plus a drop-in compatibility layer so existing v1 code keeps working.
New API
- Ground-up reimplementation under PSR-4 (
DICOM\,PACS\,DCMTK\).File::open()returns a typedDataset; tag reads and writes go through VR-validated accessors (getText,getDate,getTime,getPersonName,getUID,getInteger,getDecimal, and matching setters) backed by real value objects (Date,Time,PersonName,UID). - Conversion and networking are first-class:
Convert(toJPEG,toThumbnail,toVideo,fromJpeg,fromPdf),Compresswith aCompressionfactory (losslessSV1,lossless,baseline,extended), and PACS (EchoSCU,SCU,SCP,TransferSyntaxProposal) over aDCMTK\Toolkitabstraction. - Exception-based error model. Operations throw (
IOException,NetworkException,InvalidArgumentException) instead of returning sentinels, so failures surface at the call site instead of silently.
Compatibility
- Breaking: now requires PHP 8.5+ (was 8.0+). This is the reason for the major bump.
- Drop-in v1 compatibility layer: the legacy global surface (
dicom_tag,dicom_convert,dicom_net,is_dcm,Execute) is reimplemented on top of v2, so v1.1.0 code runs unchanged on PHP 8.5.dicom_netkeeps the v1 parameter names and defaults;transfer_syntaxis retained as an inert property that emits a deprecation pointing atPACS\TransferSyntaxProposal.
Bug fixes
- JPEG-to-DICOM works again on current DCMTK.
Convert::fromJpeg()generates UIDs directly instead of thedcm2xmltemplate path whose warning handling blocked pixel-data embedding, resolving thejpg_to_dcm()issue tracked from v1.1.0.
Testing
- Integration suite (
tests/) cross-validated with pydicom and pynetdicom: every conversion, tag operation, compression, and network call is verified by a completely separate DICOM implementation, not just read back by the tools that wrote it. CI runs on PHP 8.5 + DCMTK.
Documentation
README.mdrewritten v2-first with usage examples verified against live PHP and a full API reference.docs/migration-v1-to-v2.md: per-class v1 to v2 mapping, with before/after recipes inexamples/.
Known issues
- Callers on PHP 8.0 through 8.4 cannot upgrade and should stay on the 1.1.x line; the compatibility shims require the same PHP 8.5 + DCMTK as the core.