aschaeffer/sonata-republicandate-field-bundle
ext-calendar for date math).sonata-project/form-extensions).@RepublicandateField) and Symfony’s dependency injection.RepublicandateFieldType and RepublicandateFieldTransformer could be refactored into a standalone library (e.g., laravel-republican-date) with:
RepublicandateField extending Illuminate\Support\Facades\Form).saving hook) to sync fields.DateTime + Republican string). Laravel could mirror this with:
$table->date('birthday_gregorian')->nullable();
$table->string('birthday_republican')->nullable();
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Sonata Dependency | High | Abstract core logic; build Laravel wrapper. |
| Annotation System | Medium | Replace with Laravel traits/macros or setAccessors. |
| ext-calendar | Low | Fallback to PHP DateTime math if extension missing. |
| Sonata Version Lock | Medium | Bundle targets Symfony 4.3; ensure compatibility with Sonata 3.x/4.x. |
| Edge Cases | Medium | Test Republican date validation (e.g., Year I starts Sept 22, 1792). |
YYYY-MM-DD → An II) suffice without dual storage?ext-calendar extension available in the deployment environment?RepublicandateRule) or JavaScript masking.spatie/republican-date) and integrate it via service providers.Phase 1: Proof of Concept (1–2 weeks)
RepublicandateTransformer and RepublicandateType classes.FormRequest, Illuminate\Database\Eloquent\Casts\Attribute, or model events.Phase 2: Integration (2–3 weeks)
// App/Models/User.php
public function getBirthdayRepublicanAttribute(): string
{
return $this->convertGregorianToRepublican($this->birthday);
}
public function setBirthdayRepublicanAttribute(string $date): void
{
$this->birthday = $this->convertRepublicanToGregorian($date);
}
Illuminate\Support\Facades\Form or use Livewire to render the Republican date field.required_if_gregorian_missing).birthday_republican column to the users table.Phase 3: Sonata Interop (Optional, 1–2 weeks)
| Component | Laravel Equivalent | Notes |
|---|---|---|
| Sonata Admin | Livewire/Inertia or custom Blade admin | Full feature parity unlikely. |
| Doctrine ORM Annotations | Eloquent Attributes or Model Observers | Prefer accessors/mutators. |
| Symfony Form Types | Laravel Collective HTML or custom components | Use extends or composition. |
ext-calendar |
PHP DateTime or Carbon |
Fallback to manual date math. |
DateTime documentation for fallbacks.How can I help you explore Laravel packages today?