orisai/source-map

Generate, validate and serialize source maps

1.0.1 2024-06-21 21:52 UTC

This package is auto-updated.

Last update: 2024-12-21 22:54:18 UTC


README

Orisai
Source Map

Generate, validate and serialize source maps

📄 Check out our documentation.

💸 If you like Orisai, please make a donation. Thank you!

use Orisai\SourceMap\AnnotationSource;
use Orisai\SourceMap\ClassSource;
use ReflectionClass;

// Generate (and self-validate)
$source = new AnnotationSource(new ClassSource(new ReflectionClass(AnnotatedClass::class)));

// Print source
echo $source->toString(); // 'AnnotatedClass annotation'

// Serialize and un-serialize
$serialized = serialize($source);
$source = unserialize($serialized);
assert($source instanceof AnnotationSource);

// Ensure source is still valid after un-serialization
$source->isValid(); // bool

// Check last time source has changed
$source->getLastChange(); // DateTimeImmutable