aldaflux/user-role-type-bundle
symfony/http-foundation or symfony/options-resolver). However, Laravel’s native form handling (e.g., Illuminate\Html\FormBuilder) may require abstraction layers.display: all|standard|minimum) mirrors Laravel’s Gate/Policy system but lacks native Laravel role management (e.g., spatie/laravel-permission). Integration would require mapping Symfony’s role strings (e.g., ROLE_ADMIN) to Laravel’s permission system.aldaflux_user_role_type.yaml) is Symfony-centric. Laravel’s config/ system would need adapters (e.g., service providers to merge configs).Form facade or collective/html package could wrap the Symfony UserRoleType, but:
PRE_SET_DATA) may not directly translate to Laravel’s form lifecycle hooks.@Assert\Choice) would need Laravel equivalents (e.g., Illuminate\Validation\Rule).symfony/form). Laravel projects would need to:
symfony/form without full Symfony).replace or platform checks to avoid conflicts with Laravel’s core.UserInterface, RoleHierarchy, and Security components. Laravel’s Auth system would require:
User to Laravel’s User model (e.g., implementing Symfony\Component\Security\Core\User\UserInterface).config/aldaflux.php would require:
spatie/laravel-permission, laravel-role)? What unique value does this bundle provide?Gate/Policy system interact with Symfony’s role strings (e.g., ROLE_ADMIN)? Will a mapping layer be required?display: minimum) may require database queries per request. How will this scale in Laravel’s ORM (Eloquent)?messages+intl-icu. How will Laravel’s translation system (lang/ files) integrate with this?PHPUnit, Pest)?symfony/form, symfony/options-resolver) via Composer.symfony/framework-bundle and using only required components.UserRoleType, handling:
FormBuilding events → Laravel’s form.created).spatie/laravel-permission) to Symfony role strings.// app/Services/SymfonyRoleMapper.php
class SymfonyRoleMapper
{
public function toSymfonyRoles(array $laravelRoles): array
{
return array_map(fn($role) => "ROLE_$role", $laravelRoles);
}
}
Phase 1: Dependency Isolation
composer.json:
"require": {
"symfony/form": "^5.4",
"symfony/options-resolver": "^5.4",
"symfony/security-core": "^5.4"
},
"replace": {
"symfony/framework-bundle": "*"
}
composer update.Phase 2: Configuration Adapter
config/aldaflux.php:
// app/Providers/AldafluxServiceProvider.php
public function boot()
{
$configs = include __DIR__.'/../config/aldaflux.php';
config(['aldaflux' => array_merge($configs, [
'profiles' => $this->loadProfilesFromYaml(),
])]);
}
aldaflux_user_role_type.yaml to Laravel’s config format.Phase 3: Form Integration
// app/Extensions/FormBuilder.php
use Aldaflux\UserRoleTypeBundle\Form\Type\UserRoleType;
class LaravelFormBuilder extends \Illuminate\Support\Facades\Form
{
public static function userRoleField($name, array $options = [])
{
$form = new \Symfony\Component\Form\FormBuilder();
$form->add($name, UserRoleType::class, $options);
return $form->getForm();
}
}
{!! app('aldaflux.form')->userRoleField('roles', ['config' => 'myconfigsuper']) !!}
Phase 4: Role Hierarchy Sync
// app/Jobs/SyncRoleHierarchy.php
public function handle()
{
$symfonyRoles = $this->mapLaravelRolesToSymfony();
// Store in cache or database for performance
}
security.user_role table. Laravel would need:
spatie/laravel-permission role fields with UserRoleType.platform-check or Laravel’s package:update cautiously.config/ may diverge from Symfony’s defaults. Document changes in CHANGELOG.md.UserInterface may complicate future migrations away from the bundle.How can I help you explore Laravel packages today?