PHP code example of mukadi / settings-bundle

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

    

mukadi / settings-bundle example snippets

 php

// config/bundles.php
return [
        // ...
       Mukadi\SettingsBundle\MukadiSettingsBundle::class => ['all' => true],
    ];
 php

// src/Entity/Param.php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Mukadi\SettingsBundle\Entity\Param as Base;
/**
 * Param
 *
 * @ORM\Table(name="param")
 */
class Param extends Base
{

}
 php

// src/Controller/AppController.php

...
$setting = $this->get('mukadi_settings.setting');
$form = $setting->getForm();
 php

// src/Controller/AppController.php

...
$setting = $this->get('mukadi_settings.setting');
$form = $setting->getForm();
$form->handleRequest($request);
if($form->isSubmitted() && $form->isValid()){
    $setting->saveData($form); # store the update in the database
}
 php

// src/Controller/AppController.php
...
$setting = $this->get('mukadi_settings.setting');
$currency = $setting->get('currency'); // return 'USD' or 'CDF'
$bio = $setting->get('bio'); // return a string
$node = $setting->get('post'); // return null or a App\Entity\Post entity as configured