1. Go to this page and download the library: Download 2lenet/config-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/ */
2lenet / config-bundle example snippets
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Lle\ConfigBundle\Traits\ConfigTrait;
use App\Repository\ConfigRepository;
use Lle\ConfigBundle\Contracts\ConfigInterface;
/**
* @ORM\Entity(repositoryClass=ConfigRepository::class)
*/
class Config implements ConfigInterface
{
use ConfigTrait;
}
namespace App\Entity;
use App\Repository\ConfigRepository;
use Doctrine\ORM\Mapping as ORM;
use Lle\ConfigBundle\Contracts\ConfigInterface;
use Lle\ConfigBundle\Traits\ConfigTrait;
/**
* @ORM\Entity(repositoryClass=ConfigRepository::class)
*/
class Config implements ConfigInterface
{
use ConfigTrait;
/**
* @ORM\ManyToOne(targetEntity=Establishment::class, inversedBy="configs")
* @ORM\JoinColumn(nullable=false)
*/
private ?Establishment $establishment;
public function getEstablishment(): ?Establishment
{
return $this->establishment;
}
public function setEstablishment(?Establishment $establishment): self
{
$this->establishment = $establishment;
return $this;
}
}
public function getBool($group, $label, bool $default): bool
public function setBool(string $group, string $label, bool $value): void
public function getString($group, $label, string $default): string
public function setString($group, $label, string $value): void
public function getText($group, $label, string $default): string
public function setText($group, $label, string $value): void
public function getInt($group, $label, string $default): int
namespace App\Warmup;
use Lle\ConfigBundle\Contracts\WarmupInterface;
use Lle\ConfigBundle\Repository\AbstractConfigRepository;
class ConfigWarmup implements WarmupInterface
{
public function warmup(AbstractConfigRepository $configRepository): void
{
$configRepository->initBool('CONFIG', 'active', true);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.