Skip to content

qoliber Magento 2 Extension Development Guidelines

The following guidelines outline the best practices and standards to be followed for the development of Magento 2 extensions. All extensions must adhere to these guidelines to ensure high performance, maintainability, and compatibility with industry standards.

1. Code Quality Standards

1.1 Code Sniffer

1.2 PHPStan - Level 8

2. Performance Optimization

2.1 Blackfire Profiling

  • All code is profiled using 🔥 Blackfire to ensure it does not introduce performance bottlenecks.
  • Optimizations should be implemented based on profiling results, ensuring scalability for large datasets.

3. Compatibility

3.1 Magento Framework Compatibility

  • Magento Open Source (2.4.x and higher)
  • Adobe Cloud (2.4.x and higher)
  • Adobe Commerce (2.4.x and higher)
  • MageOS

3.2 Hyvä Themes Compatibility

  • Ensure all extensions are fully compatible with Hyvä Themes.
  • Follow Hyvä best practices to ensure that templates, CSS, and JavaScript integrations work seamlessly.

3.3 ElasticSuite Compatibility

  • Extensions must be compatible with ElasticSuite for advanced search functionality.
  • Test integration with ElasticSuite thoroughly to ensure no conflicts or performance degradation.

4. Event Handling & Class Overrides

4.1 Plugin (Interceptor) Preference

  • Use Plugins as the first choice for customization or platform behavior modification.
  • Observers should only be used if a plugin is not suitable for the task at hand.
  • Preferences should be avoided and used only when absolutely necessary and no other solution is possible.

5. Scalability Testing

  • All extensions must be tested on small, medium, and large datasets:
    • Small: Less than 1,000 products and 1 store view.
    • Medium: 10,000 products and 2 store views.
    • Large: 250,000 products and 4 store views.
  • Ensure that performance and functionality remain consistent and optimal across all dataset sizes.

6. Additional Best Practices

6.1 Documentation

  • Each extension must include comprehensive developer documentation, including setup, configuration options, and at least one usage examples.

6.2 Modularity

  • Extensions should follow a modular architecture wherever possible, separating concerns into distinct components to promote reusability and clarity.

6.3 Security

  • Validate all user inputs and escape outputs to prevent security vulnerabilities like SQL injection or XSS attacks.
  • Ensure code is compliant with Magento’s security best practices.

6.4 Deployment

  • All extensions must be compatible with CI/CD pipelines and support automated deployment processes.
  • Ensure that version control practices are followed, with clear versioning and release notes for each iteration.

6.5 Testing

  • unit tests, integration tests, and functional tests are only created when required to test complex features
  • If applicable, use Magento's test framework to automate test cases.

7. 📦 Package Management & Distribution

7.1 Private Packagist for Paid Extensions

  • Paid extensions are distributed through Private Packagist.
  • This ensures controlled access to premium code and the ability to manage subscription-based licenses.

7.2 Public Packagist for Free Extensions

  • Free extensions must be made available via public Packagist to ensure they are widely accessible to the community.
  • Ensure proper versioning and descriptions are maintained on the public Packagist repository.

By following these guidelines, we ensure that all Magento 2 extensions are built to high standards of quality, performance, and compatibility, ultimately delivering robust and scalable solutions for clients.