- What is ruwork/polyfill-form-dti and what does it do?
- ruwork/polyfill-form-dti is a lightweight Composer polyfill that provides the Symfony Form DateTimeImmutable API, including a missing interface and related classes, on older PHP or framework versions. It exists so packages that depend on that API can install and run unchanged. It is autoloaded, dependency-free, and requires no configuration.
- Does ruwork/polyfill-form-dti work with Laravel?
- Technically it can be installed with Composer if dependency constraints allow it, but it is a poor fit for a standard Laravel application. Laravel uses Blade, request validation, Eloquent casts, and its own validation pipeline rather than Symfony Form as its form layer. It only makes sense in a Laravel app that deliberately embeds Symfony Form or must preserve a legacy Symfony Form workflow.
- How do I install ruwork/polyfill-form-dti in a Laravel app?
- You would run composer require ruwork/polyfill-form-dti, but first use composer require --dry-run in a throwaway branch to check PHP and Symfony version conflicts. The package has no Laravel service provider, configuration file, Blade directive, validation rule, or Eloquent integration, so installation alone does not wire it into Laravel. For normal Laravel forms, a native Blade component plus CarbonImmutable or DateTimeImmutable casts is the practical path.
- Which Laravel and PHP versions support ruwork/polyfill-form-dti?
- The package has had no release since 2018, so its Composer constraints likely target older Symfony and PHP versions. Laravel 10, 11, and 12 typically run on modern PHP with Symfony components 6 or 7, so expect conflicts or deprecation failures. Always verify constraints with a dry-run before adding it to a Laravel composer manifest.
- Do I need ruwork/polyfill-form-dti for DateTimeImmutable in Laravel forms?
- No, not for standard Laravel forms. Laravel can handle immutable dates with CarbonImmutable or DateTimeImmutable casts, Blade datetime-local inputs, and validation rules such as date, after, and before. The polyfill is only relevant when a dependency specifically requires the Symfony Form DateTimeImmutable API on an older stack.
- What are the alternatives to ruwork/polyfill-form-dti in Laravel?
- For Laravel-native forms, use Blade components or form macros with datetime-local inputs, Laravel validation rules, and CarbonImmutable or DateTimeImmutable casts on models. If you must keep Symfony Form, use a maintained Symfony version that includes the native feature rather than a 2018 polyfill. You can also copy the MIT-licensed approach into a small internal component.
- Is ruwork/polyfill-form-dti maintained and safe for production?
- It has 1 star, 0 dependents, and no release since 2018, which signals abandonment and no security-response expectation. The MIT license permits a fork, but your team would then own compatibility, testing, and security triage. For a production Laravel application, treat it as a reference implementation rather than a dependency.
- How do I render HTML5 datetime-local inputs in Laravel?
- Use a Blade component or form macro that outputs an input with type datetime-local, and bind it to a CarbonImmutable or DateTimeImmutable value. Validate the submitted value with Laravel rules such as date, after, and before. Normalize time zones at the boundary and store a consistent UTC or application timezone value.
- How should I handle time zones and DST with DateTimeImmutable in Laravel forms?
- Be explicit about the application timezone and the browser timezone, and convert at the boundary rather than relying on implicit behavior. Test DST transitions, immutable-versus-mutable values, and validation alignment because date and time handling carries inherent risk. Native Laravel validation and CarbonImmutable casts give you clearer control than a narrow Symfony Form polyfill.
- Can I fork or copy ruwork/polyfill-form-dti instead of depending on it?
- Yes, the MIT license permits a fork or an internal reimplementation, which is often more practical than adding the dependency to Laravel. If you fork, you own compatibility, testing, and security triage, and you should plan a retirement path. For most Laravel apps, implementing the behavior natively in Blade plus validation and casts is the better option.