PHP code example of mindy / setting-bundle

1. Go to this page and download the library: Download mindy/setting-bundle 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/ */

    

mindy / setting-bundle example snippets


$settingsManager->all();

$settingsManager->all($myPrefix);

class OrderSettings implements FormAwareSettingsInterface
{
    // ...
    
    public function getForm(): string
    {
        return OrderSettingsForm::class;
    }
}

$settings = $this->get(OrderSettings::class);
$form = $this->createForm($settings->getForm(), $settingsManager->all($settings->getPrefix()), [
    'method' => 'POST',
]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
    $valid = [];
    foreach ($form->getData() as $key => $value) {
        $valid[sprintf("%s.%s", $settings->getPrefix(), $key)] = $value;
    }
    
    $settingsManager->set($valid);
    
    // ...
}