baks-dev/materials-category
Laravel/PHP модуль «Materials Category» для каталога сырья: управление категориями и структурами материалов, интеграция с baks-dev/materials-catalog. Установка через Composer, тесты PHPUnit (group=materials-category). PHP 8.4+. MIT лицензия.
ContainerInterface must be wrapped to work with Laravel’s Illuminate\Container.Category entity → Category model with HasFactory, SoftDeletes).Validator must be replaced with Laravel’s Validator facade or a custom bridge.CategoryCreatedEvent) should be mapped to Laravel’s event system (e.g., CategoryCreated).baks-dev/core (v7.4+) introduces maintenance risk. Assess whether core functionality can be decoupled or replaced with Laravel-native packages (e.g., spatie/laravel-activitylog for auditing, spatie/laravel-permission for RBAC).Illuminate\Contracts\Container\Container.HasFactory, SoftDeletes, and BelongsToMany relationships.Schema builder, but complex relationships (e.g., many-to-many with pivot tables) may need manual adjustments. Example:
// Doctrine → Laravel Schema Migration
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug')->unique();
$table->unsignedBigInteger('parent_id')->nullable();
$table->foreign('parent_id')->references('id')->on('categories')->onDelete('cascade');
$table->timestamps();
});
Validator facade or create a service provider bridge:
// app/Providers/ValidatorServiceProvider.php
public function register()
{
$this->app->bind(
\Symfony\Component\Validator\Validator\ValidatorInterface::class,
function ($app) {
return \Illuminate\Support\Facades\Validator::make([], []);
}
);
}
Event system using a listener wrapper:
// app/Listeners/SymfonyEventListener.php
public function handle(SymfonyEvent $event)
{
event(new LaravelEvent($event->getData()));
}
Route::apiResource('categories', CategoryController::class)->middleware('auth:sanctum');
CategoryHierarchyTest) to validate:
| Risk | Impact | Mitigation Strategy |
|---|---|---|
| Unmaintained Package | High | Fork the repository immediately; monitor baks-dev/core for breaking changes. |
| Symfony-Laravel Abstraction | Medium | Use interfaces and dependency injection wrappers (e.g., ContainerInterface). |
| PHP 8.4+ Dependency | Medium | Conduct a compatibility audit with Laravel’s PHP version constraints. |
| Undocumented Features | High | Perform black-box testing (e.g., hierarchy edge cases, bulk import limits). |
| Localization Gaps | Low | Override model labels or add a localization table with locale and translation fields. |
| Performance with Deep Trees | Medium | Implement materialized paths or closure tables for N-level hierarchies. |
| Missing API/CLI | Medium | Build a Laravel API resource or Artisan command for bulk operations. |
baks-dev/core be replaced with Laravel-native alternatives (e.g., spatie/laravel-permission for RBAC)?core evolves (e.g., major version bumps)?CategoryCreated) or queues for async operations?spatie/laravel-category-tree (active maintenance) or orchid/platform (monolithic but feature-rich).Laravel Compatibility Matrix:
| Component | Compatibility | Workaround |
|---|---|---|
| PHP 8.4+ | ✅ Supported (Laravel 10+) | Upgrade if using PHP <8.4. |
| Symfony Container | ❌ Incompatible | Create a wrapper service provider to bridge Symfony’s ContainerInterface to Laravel’s. |
| Doctrine ORM | ❌ Incompatible | Replace with Eloquent models and translate migrations. |
| Symfony Validator | ❌ Incompatible | Use Laravel’s Validator facade or a custom validation bridge. |
| Event System | ❌ Incompatible | Map Symfony events to Laravel’s Event system via listeners. |
| Console Commands | ❌ Incompatible | Replace with Laravel Artisan commands or API endpoints. |
| Twig Templates | ❌ Incompatible | Use Blade or Livewire for frontend integration. |
| Laravel Eloquent | ✅ Compatible (with abstraction) | Extend Eloquent models to include package-specific logic. |
| Laravel Middleware | ✅ Compatible | Wrap package routes with Laravel middleware (e.g., auth, throttle). |
| Laravel Queues | ⚠️ Partial | Extend package logic to dispatch Laravel queue jobs (e.g., CategoryImportJob). |
| Laravel Scout (Search) | ❌ Not supported | Integrate Algolia or Meilisearch separately. |
Recommended Tech Stack Additions:
How can I help you explore Laravel packages today?