Hi @RabiiRahmouni ,
1. Architecture Migration – Laravel DI to Adobe Commerce Module System
Laravel's Service Container => Adobe Commerce's Dependency Injection (DI)
- In Laravel, services are registered via service providers.
- In Adobe Commerce, dependencies are injected via constructor DI, configured using di.xml.
Adobe Commerce Best Practice:
- Use custom modules to encapsulate business logic like in Laravel service classes.
- Define all dependencies in di.xml for service classes, plugins, or observers.
<!-- app/code/Vendor/Module/etc/di.xml -->
<type name="Vendor\Module\Model\VehiclePartMatcher">
<arguments>
<argument name="vehicleRepository" xsi:type="object">Vendor\Module\Model\VehicleRepository</argument>
</arguments>
</type>
Best Approach for Dependency Injection:
- Understand Adobe Commerce's Module System: Adobe Commerce uses a modular architecture with a focus on dependency injection (DI). Familiarize yourself with the di.xml configuration files where you can define your dependencies.
- Service Contracts: Use service contracts to define interfaces for your services. This will help you maintain a clean architecture and allow for easier testing and maintenance.
- Mapping Laravel Services to Adobe Commerce: Identify your Laravel services and map them to Adobe Commerce modules. Create custom modules for your services, ensuring that you follow Adobe Commerce's conventions for naming and structure.
2. Custom Catalog Logic – Vehicle-Part Compatibility
This is a domain-specific relationship model, not natively supported in Adobe Commerce.
Best Practice:
Use a custom EAV attribute or create a separate custom entity for vehicle compatibility.
Options:
Option 1: Custom Product Attribute (limited)
- Create a compatible_vehicles multiselect attribute.
- Suitable if compatibility is simple and static.
Option 2: Custom Entity with Relationship Table (Recommended)
- Create a vehicle entity with fields like make, model, year, etc.
- Create a many-to-many relation: product_id => vehicle_id
Admin UI: Use UI Components to allow selection of compatible vehicles.
DB Schema Example:
product_vehicle_compatibility (
id INT PRIMARY KEY,
product_id INT,
vehicle_id INT
)
Extend product page (frontend + admin) to show compatible vehicles using block and template overrides.
3. API Strategy – Mobile Integration
Adobe Commerce REST APIs are powerful but limited in flexibility for nested data relationships.
Best Practice: Use GraphQL for Frontend + Mobile Apps
- Extend GraphQL with custom resolvers for your business logic.
- GraphQL is now first-class in Adobe Commerce and has better cache control and versioning.
Implementation Steps:
- Add schema definition in etc/graphql/schema.graphqls
- Create resolver classes using ResolverInterface
Example:
type Query {
compatibleVehicles(productId: Int!): [Vehicle]
}
class CompatibleVehicles implements ResolverInterface {
public function resolve(...) {
// Fetch and return vehicles for given product
}
}
4. Performance Considerations – 50k+ SKUs + Real-Time Inventory
Best Practices for Adobe Commerce Scaling:
1. Use Opensearch:
- Ensure catalog search and layered navigation use Opensearch
2. Enable Varnish:
- Use Varnish cache for full-page caching (FPC).
- Combine with Fastly if using Adobe Commerce Cloud.
3. Asynchronous Inventory Updates:
- Don’t update inventory in real-time on user requests.
- Use Message Queues (RabbitMQ) or Adobe MSI APIs for async inventory sync.
4. Index Management:
- Set indexers to Update by Schedule.
- Reindex via cron, not during product save.
5. Split Database:
- Use DB Split: separate checkout, sales, and main DBs for better scale (only Adobe Commerce, not Open Source).
6. Use Adobe Commerce B2B Features (if applicable):
- Shared catalogs
- Company accounts
- Advanced permissions
5. Third-party Integration – Supplier API Maintenance
If your supplier APIs are external and you rely on real-time or scheduled syncs, don't migrate the API logic 1:1.
Best Practices:
1. Create Integration Module Per Supplier
app/code/Vendor/SupplierConnector
- Service classes => API client
- Cron jobs => Sync scheduler
- Queue jobs => Retry logic
2. Use Adobe Commerce Integration APIs
- Register external APIs via webapi.xml for secure communication.
3. Error Handling + Logs
- Use Magento's Logger (Psr\Log\LoggerInterface) for debug/error logging.
- Use var/log for integration logs.
4. Use Cron for Batch Jobs
- Schedule hourly/daily product, price, and stock updates.
5. Use Queue (RabbitMQ)
- Push data to queues for async processing.
Migration Roadmap
- Audit Laravel Features => Create parity map with Adobe Commerce features
- Define Custom Modules for features that don’t exist
- Migrate Catalog Data (write ETL scripts or use Data Migration Tool)
- Set Up Adobe Commerce Environment (preferably on Commerce Cloud or scalable infra)
- Implement Custom APIs / GraphQL Extensions
- Test Performance + Caching
- Rebuild Mobile App Integration
Regards,
Amit