PHP code example of helis / settings-manager-bundle
1. Go to this page and download the library: Download helis/settings-manager-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/ */
helis / settings-manager-bundle example snippets
class AppKernel extends Kernel
{
public function registerBundles()
{
return [
new Helis\SettingsManagerBundle\HelisSettingsManagerBundle(),
];
}
}
use Helis\SettingsManagerBundle\Settings\Traits\SettingsRouterAwareTrait;
class MuchAmazingService
{
use SettingsRouterAwareTrait;
public function doSmth()
{
if ($this->settingsRouter->getBool('foo')) {
// do it
}
// just do it
}
}
declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Helis\SettingsManagerBundle\Model\SettingModel;
#[ORM\Entity()]
#[ORM\Table(name: "setting")]
class Setting extends SettingModel
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer")]
protected int $id;
}
...
use SettingsIntegrationTrait;
protected function setUp()
{
parent::setUp();
SettingsProviderMock::addSetting(
(new SettingModel())
->setName('awesome_setting')
->setDomain(
(new DomainModel())
->setName('some_domain')
->setEnabled(true)
)
);
}
...
public function indexAction(): Response
{
$this->denyUnlessEnabled('index_page');
...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.