ntlab/php-obj
ntlab/php-obj is a lightweight PHP utility for working with objects, offering simple helpers for inspection, conversion, and manipulation. Composer-ready and dependency-free, it suits small projects needing basic object tooling without a heavy framework.
Architecture fit
ntlab/php-obj is a narrow object-representation utility: it projects a PHP object into a plain string, a JavaScript literal, a PHP annotation, or YAML. It is not a framework, ORM, or transport layer, so it introduces no structural constraints on a Laravel application.ObjectRepresentationService) or a thin facade, with the package namespace referenced in exactly one place. It must not leak into controllers, Eloquent models, jobs, or Blade views.Integration feasibility
composer require; MIT licensing removes legal friction. There is no Laravel service provider, no publishable config, and no facade, which is appropriate for a utility but means integration is entirely manual and small.Technical risk
Key questions
Closure, resource, DateTimeImmutable, and nested collections?symfony/yaml? Is JS output safely escaped for arbitrary string content, including unicode and quotes?Stack fit
symfony/yaml, already transitively present in most Laravel applications, as an independent validator of emitted YAML. Expose it through a single Artisan command as the primary entry point.ObjectRepresentationService interface so the implementation can be swapped for var_export, Symfony\Component\Serializer, or a hand-rolled emitter without touching call sites.Migration path
var_export plus a small custom emitter for scalar projections. Designing the wrapper first makes this a one-file change.Compatibility
composer.json (no caret range) and commit composer.lock; with no dependents, patch releases are effectively unvetted.Sequencing
symfony/yaml, JSON.parse the JS output, and lint generated annotations. Malformed output must fail loudly in the spike.Maintenance
Support
Scaling
Failure modes
setAccessible, and enum handling will throw or emit incomplete output. Mitigate with a representative-object fixture suite covering all four formats.Ramp-up
How can I help you explore Laravel packages today?