symfony/property-access
Symfony PropertyAccess lets you read and write values on objects and arrays using a simple property path string notation. It supports nested access, getters/setters, and array indexes, making data mapping and form handling easier.
Arr::get(), data_get()) by extending functionality to objects and deeply nested structures while maintaining consistency with Symfony’s battle-tested patterns. Aligns with Laravel’s dependency injection and service container for seamless integration.'user.profile.settings'). Integrates well with Laravel’s API resources, Form Requests, and serialization (e.g., spatie/array-to-object).Serializer, Validator) without requiring full Symfony adoption. Reduces duplication for teams using both frameworks.PropertyAccess::createPropertyAccessor()). Can be wrapped in a Laravel service provider for global access.Arr::get() + manual methods).PropertyAccess::createPropertyAccessor()->setUsed(true)).AllowedPropertyAccessor).user.* is safe, user.token is restricted).Property::get($object, 'path')).^6.4 for LTS stability or ^8.0 for PHP 8.4 features.$accessor->setUsed(true))?user.password) that require special handling?'user.profile.settings' vs. $user->profile->settings)?Arr::get(), data_get()) or custom reflection?spatie/array-to-object) for simpler use cases?AppServiceProvider:
$this->app->singleton(PropertyAccessInterface::class, function ($app) {
return PropertyAccess::createPropertyAccessor();
});
Property::get($object, 'path')) to hide Symfony’s API.^6.4 for LTS stability or ^8.0 for PHP 8.4 features.Request objects or API resources for payload transformation.Validator for dynamic rules (e.g., rule('user.profile.settings.*', 'required')).array-to-object or Laravel’s JsonResponse for clean data mapping.Arr::get() + manual methods).Property::get()) to abstract Symfony’s API.'user.profile.*' vs. 'user.token').$accessor->setUsed(true)).user.password).Arr::get(): Limited to arrays; this extends to objects and nested structures.data_get(): Similar but lacks object traversal and getter/setter support.collect(): No native property path support; this fills the gap.Serializer: Works seamlessly for object ↔ array conversion.Validator: Enables dynamic validation rules (e.g., rule('user.profile.*', 'array')).Form: Simplifies nested form field access (e.g., 'user.address.city').array-to-object: Complements this for array ↔ object conversion.How can I help you explore Laravel packages today?