baks-dev/products-product
BaksDev Product — модуль продукции для PHP 8.4+: управление продуктами и интеграция с категориями, валютами, деньгами и единицами измерения. Поддерживает установку ассетов, миграции Doctrine и тесты PHPUnit.
observers or event system to extend behavior (e.g., triggering inventory updates on product creation).ProductMedia via traits).with() or query scopes.products → categories → measurements). For NoSQL or graph databases, a rewrite would be needed.products-category, reference-money, etc.) add complexity but are Laravel-compatible (e.g., spatie/laravel-activitylog for auditing).baks:assets:install and migrations suggest CLI-driven workflows (e.g., bulk imports).spatie/laravel-graphql.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Dependency Conflicts | High | Audit composer.json for version clashes (e.g., doctrine/dbal vs. Laravel’s). Use composer why-not. |
| Migration Conflicts | Medium | Test migrations in a staging DB; use doctrine:schema:update --dump-sql for dry runs. |
| PHP 8.4+ Dependency | Medium | Upgrade CI/CD and staging to PHP 8.4+; monitor for breaking changes in future Laravel releases. |
| Undocumented APIs | Low | Document public methods via PHPDoc or adapters; wrap in service classes if needed. |
| Localization Gaps | Low | Scan for hardcoded strings (e.g., Russian labels); plan for i18n (e.g., laravel-localization). |
| Testing Coverage | Medium | Supplement package tests with integration tests for custom workflows (e.g., product + inventory). |
src/ for validation logic; extend with custom rules if gaps exist.doctrine:migrations:migrate --dry-run.resources/views or routes/api.php for out-of-the-box support.Product models with the package’s entities.ProductCreated) for cross-cutting concerns.doctrine/dbal. Use migrations for schema changes.Route::apiResource with resource controllers.spatie/laravel-graphql for flexible queries.beyondcode/laravel-websockets for real-time updates (e.g., inventory).Dependency Setup:
composer require baks-dev/products-category baks-dev/reference-money baks-dev/reference-currency baks-dev/reference-measurement baks-dev/products-product
spatie/laravel-permission). Resolve with:
composer why-not spatie/laravel-permission
composer update --with-all-dependencies
Configuration:
php bin/console baks:assets:install
config/baks.php (e.g., storage paths, API prefixes).Database Migration:
php bin/console doctrine:migrations:diff --dry-run
php bin/console doctrine:migrations:migrate --env=staging
Service Provider Integration:
config/app.php:
Baks\Products\ProductsProductServiceProvider::class,
$this->app->bind(
\Baks\Products\Repositories\ProductRepository::class,
\App\Repositories\CustomProductRepository::class
);
Routing:
routes/api.php):
Route::prefix('v1/products')->group(function () {
Route::get('/', [ProductController::class, 'index']);
Route::post('/', [ProductController::class, 'store']);
Route::get('/{product}', [ProductController::class, 'show']);
});
Testing:
php bin/phpunit --group=products-product
// tests/Feature/ProductInventorySyncTest.php
public function test_product_creation_triggers_inventory_event()
{
$product = Product::factory()->create();
$this->assertDatabaseHas('inventory', ['product_id' => $product->id]);
}
| Component | Compatibility Notes |
|---|---|
| Laravel 10.x | Tested on PHP 8. |
How can I help you explore Laravel packages today?