- What Laravel and PHP versions does baks-dev/products-stocks support?
- This package requires **PHP 8.4+** and is optimized for **Laravel 10+**. If you're using an older Laravel version, you may encounter Symfony component conflicts. Test in a staging environment with your target stack before full integration.
- How do I install and configure the package?
- Run `composer require baks-dev/products-stocks`, then execute `php artisan baks:assets:install` to set up config and assets. Use `php artisan doctrine:migrations:diff` to review schema changes, then apply them with `php artisan doctrine:migrations:migrate`. Override defaults in `config/baks-products-stocks.php`.
- Does this package support multi-warehouse inventory management?
- Yes, the module includes warehouse management out of the box. However, for global or highly scalable deployments, you may need custom extensions (e.g., geo-based routing or multi-currency support). Review the `StockService` and `Warehouse` entity for extensibility points.
- Can I integrate this with existing stock logic in my Laravel app?
- The package is designed for modular integration. Audit your existing inventory logic before migrating—document tables, business rules, and integrations. Replace legacy stock calls with the module’s `StockService` incrementally, using feature flags for phased rollouts.
- Are there pre-built tests or examples for critical workflows like stock transfers?
- The package includes PHPUnit tests under the `products-stocks` group, but custom integration tests for workflows like stock transfers or low-stock alerts may be needed. Use the existing tests as a template to build your own validation suite.
- What databases does this package support, and how do I handle schema conflicts?
- The package supports **MySQL, PostgreSQL, and SQLite** via Doctrine ORM. To avoid schema conflicts, run `php artisan doctrine:migrations:diff` pre-integration and review changes. For legacy data, use backfill scripts or Doctrine fixtures.
- How do I handle failed migrations or data corruption?
- Run migrations in dry-run mode first (`--dry-run`) to preview changes. For rollbacks, use Doctrine’s built-in migration reversal or create custom scripts. Always back up your database before applying migrations in production.
- Does the package support event-driven workflows (e.g., StockUpdated events)?
- The package does not explicitly document event listeners, but you can extend it by creating custom events (e.g., `StockUpdated`) and listeners. Reverse-engineer the `StockService` or check the test suite for clues on how to trigger domain events.
- Are there alternatives if I need advanced ERP features like expiry tracking?
- This package focuses on core inventory management (stock, warehouses, movements) and lacks built-in ERP features like expiry tracking or multi-currency. For advanced use cases, extend the module via custom services or consider packages like `spatie/laravel-activitylog` for auditing or `torchlight/laravel-expiry` for expiry tracking.
- How can I test the package in my Laravel application before full deployment?
- Run the package’s tests with `php artisan test --group=products-stocks` to validate core functionality. For integration testing, mock your existing product and warehouse data, then test critical paths like stock adjustments or transfers. Use Docker to containerize testing with your target PHP/Laravel versions.