ecourty/platform-parameter-bundle
.env or static config files). Offers type safety (via Doctrine entities) and caching, which Laravel lacks natively for dynamic platform-wide parameters.Bundle system is incompatible with Laravel’s composer autoloading and service provider model.doctrine/dbal + custom mappings).Container with Laravel’s ServiceProvider/Binding.Cache component) can be replaced with Laravel’s Cache facade.| Risk Area | Description | Mitigation Strategy |
|---|---|---|
| Architecture Mismatch | Symfony’s event system, bundles, and DI container are incompatible with Laravel. | Abstract core logic into Laravel-compatible services (e.g., ParameterRepository, ParameterCache). Use facades to hide Symfony-specific code. |
| Database Schema | Doctrine migrations (e.g., Parameter entity) won’t work out-of-the-box in Laravel. |
Create equivalent Eloquent models and manual migrations. Use doctrine/dbal if complex schema changes are needed. |
| Caching Layer | Symfony’s cache system differs from Laravel’s. | Replace with Laravel’s Cache facade or Redis/Memcached. Ensure cache tags/invalidation align with Laravel’s conventions. |
| Admin Interface | EasyAdmin is Symfony-specific. | Replace with Filament, Nova, or a custom Laravel Livewire/Tailwind admin panel. |
| Type Safety | Laravel’s runtime type checking (PHP 8.0+) can emulate this, but Symfony’s Parameter entity validation may need adaptation. |
Use Laravel’s model casting and validation rules (e.g., Illuminate\Validation\Rules). |
| CLI Commands | Symfony console commands won’t register in Laravel. | Rewrite commands as Laravel Artisan commands or expose functionality via API routes. |
| Twig Integration | Twig is Symfony’s templating engine; Laravel uses Blade. | Create a Blade directive or service provider to expose parameters to views. Alternatively, use API endpoints to fetch parameters in frontend JS. |
.env + config caching may suffice.spatie/laravel-config-array, beberlei/doctrineextensions) to avoid reinventing the wheel?| Laravel Component | Bundle Equivalent | Integration Strategy |
|---|---|---|
| Service Container | Symfony’s DI Container | Replace with Laravel’s ServiceProvider and bind() method. Use facades for parameter access (e.g., PlatformParameter::get('key')). |
| ORM | Doctrine Entities | Replace with Eloquent models (Parameter table with key, value, type, description columns). Use model casting for type safety (e.g., JSON, booleans, enums). |
| Database | Doctrine Migrations | Use Laravel’s migrations to create the parameters table. For complex schemas, consider doctrine/dbal as a bridge. |
| Caching | Symfony Cache Component | Replace with Laravel’s Cache::remember() or Cache::tags(). Implement cache invalidation on parameter updates (e.g., Cache::forget() or tag-based purging). |
| Admin Interface | EasyAdmin CRUD | Replace with Filament, Nova, or a custom Livewire panel. Map EasyAdmin’s fields (e.g., ParameterType, ParameterValue) to Laravel’s form components. |
| CLI | Symfony Console Commands | Rewrite as Artisan commands (e.g., php artisan platform:parameters:list). Use Laravel’s Command class and Artisan::call(). |
| Templating | Twig Integration | Expose parameters via Blade directives (e.g., @platformParameter('key')) or API endpoints for SPAs. Use Laravel’s View::share() for global access. |
| Validation | Symfony Validator | Use Laravel’s Form Request validation or model rules (e.g., protected $casts = ['value' => 'json']). |
Assessment Phase (1-2 weeks):
.env, config files, database tables).Core Implementation (3-4 weeks):
Parameter model with migrations.
// app/Models/PlatformParameter.php
class PlatformParameter extends Model {
protected $casts = [
'value' => 'json', // or string/boolean based on type
];
}
ParameterService to handle CRUD + caching.
// app/Services/PlatformParameterService.php
class PlatformParameterService {
public function get(string $key, $default = null) {
return Cache::remember("platform_param_{$key}", now()->addHours(1), fn() =>
PlatformParameter::where('key', $key)->value('value')->first()
);
}
}
Parameter entity logic with Laravel equivalents.Admin Interface (2-3 weeks):
// app/Filament/Resources/PlatformParameterResource.php
class PlatformParameterResource extends Resource {
public static function form(Form $form): Form {
return $form->schema([
TextInput::make('key')->required(),
SelectInput::make('type')->options(['string', 'boolean', 'json']),
TextareaInput::make('value'),
]);
}
}
Templating & CLI (1 week):
Testing & Optimization (1-2 weeks):
| Dependency | Laravel Equivalent/Alternative | Notes |
|---|---|---|
| Symfony Cache | Laravel Cache (Illuminate\Cache) or Redis |
Use Cache::tags() for grouped invalidation (e |
How can I help you explore Laravel packages today?