gacela-project / gacela-project.com

Gacela Project Website

Home Page:https://gacela-project.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update docs for bootstrap & setup

Chemaclass opened this issue · comments

Update the docs

################################################
# BEFORE (deprecated) ##########################
################################################
$setup = (new SetupGacela())
    ->setConfig(function (ConfigBuilder $configBuilder): void {
        $configBuilder->add('config.php', 'config-local.php');
    }) 
    ->setSuffixTypes(
        static function (SuffixTypesBuilder $suffixTypesBuilder): void {
            $suffixTypesBuilder->addDependencyProvider('Binding');
        }
    });

################################################
# AFTER (new style; simpler UX) ################
################################################
$setup = function(GacelaConfig $config): void {
    $config->addAppConfig('config.php', 'config-local.php');
    $config->addSuffixTypeDependencyProvider('Binding')
};
# or even using an arrow-fn
$setup = fn (GacelaConfig $config) => $config
    ->addAppConfig('config.php', 'config-local.php')
    ->addSuffixTypeDependencyProvider('Binding');

# --------------

// and `$setup` would be the _returning value_ from `gacela.php` file, 
// OR it would go as 2nd argument to the bootstrap fn, for example:
Gacela::bootstrap($projectRootDir, $setup);

for reference see: gacela-project/gacela#148