public static function boot(array $config)
    {
        if (self::$booted) {
            return;
        }
        
        /**
         * Loader.
         */
        if (!isset($config['loader'])) {
            throw new BadMethodCallException(
                'Requires at least loader instance or configuration'
            );
        } else {
            if (is_array($config['loader'])) {
                // require_once __DIR__ . '/Rails/Loader/Loader.php';
                $loader = new Rails\Loader\Loader();
                
                if (isset($config['loader']['paths'])) {
                    $loader->addPaths($config['loader']['paths']);
                }
                
                if (isset($config['loader']['composerAutoloader'])) {
                    $loader->setComposerAutoloader(
                        $config['loader']['composerAutoloader']
                    );
                } else {
                    $loader->addPath(__DIR__ . '/Rails');
                }
                $loader->register();
            } elseif ($config['loader'] instanceof Rails\Loader\Loader) {
                $loader = $config['loader'];
            } else {
                throw new InvalidArgumentException(
                    sprintf(
                        'Loader must be either array or instance of Rails\Loader\Loader, %s passed',
                        gettype($config['loader'])
                    )
                );
            }
        }
        
        /**
         * Service Manager.
         */
        $sm = new Zend\ServiceManager\ServiceManager();
        self::$serviceManager = $sm;
        $sm->setService('loader', $loader);
        
        /**
         * Global configuration.
         */
        $sm->setService('rails.config', new Rails\ActiveSupport\ArrayObject([
            'use_cache' => false
        ]));
        
        /**
         * Inflector.
         */
        $sm->setFactory('inflector', function() {
            return new Rails\ActiveSupport\Inflector\Inflector(
                new Rails\ActiveSupport\Inflector\Inflections\EnglishInflections,
                'en'
            );
        });
        
        /**
         * Translator.
         */
        $sm->setFactory('i18n', function() {
            $tr = new Rails\I18n\LoadingTranslator();
            $tr->setDefaultLocale('en');
            $tr->setLoader(new Rails\I18n\Loader());
            
            
            # Add Rails' locales paths to i18n loader
            $tr->loader()->addPaths([
                __DIR__ . '/Rails/ActiveSupport/Carbon/locales',
                __DIR__ . '/Rails/I18n/locales',
            ]);
            
            return $tr;
        });
        
        self::$booted = true;
    }