PHP code example of hryvinskyi / magento2-production-component-registration

1. Go to this page and download the library: Download hryvinskyi/magento2-production-component-registration library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hryvinskyi / magento2-production-component-registration example snippets


$patterns = atterns as $pattern) {
    $matches = glob($baseDir . $pattern, GLOB_NOSORT);
    array_map(static function ($path) {
        


declare(strict_types=1);

use Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register('module', 'CustomVendor_ExtensionA', '/app/code/CustomVendor/ExtensionA');
ComponentRegistrar::register('module', 'CustomVendor_ExtensionB', '/app/code/CustomVendor/ExtensionB');
ComponentRegistrar::register('theme', 'frontend/Custom/design', '/app/design/frontend/Custom/design');
// Additional components registered statically

   // app/etc/env.php
   return [
       'MAGE_MODE' => 'production'
   ];
   
bash
composer dump-autoload