PHP code example of webberdoocom / installer-bundle
1. Go to this page and download the library: Download webberdoocom/installer-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/ */
webberdoocom / installer-bundle example snippets
return [
// ... other bundles
Webberdoo\InstallerBundle\InstallerBundle::class => ['all' => true],
];
class User implements UserInterface
{
private ?string $email = null; // ✅ Detected as email field
private ?string $password = null; // ✅ Detected as password field
private array $roles = []; // ✅ Detected as roles field
// Optional fields - will be set if they exist:
private ?string $fullName = null; // ✅ Auto-detected
private bool $isActive = true; // ✅ Auto-detected
// SMTP fields (optional) - Auto-detected if present:
private ?string $smtpHost = null; // ✅ For email configuration
private ?int $smtpPort = null; // ✅ Auto-detected
private ?string $smtpUsername = null; // ✅ Auto-detected
private ?string $smtpPassword = null; // ✅ Auto-detected
private ?string $smtpEncryption = null; // ✅ Auto-detected (tls/ssl)
private ?string $smtpFromEmail = null; // ✅ Auto-detected
private ?string $smtpFromName = null; // ✅ Auto-detected
// Standard getters/setters...
}
namespace App\Entity;
use Symfony\Component\Security\Core\User\UserInterface;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table(name: 'users')]
class User implements UserInterface
{
// Required fields...
#[ORM\Column(type: 'string', length: 180, unique: true)]
private ?string $email = null;
#[ORM\Column(type: 'string')]
private ?string $password = null;
#[ORM\Column(type: 'json')]
private array $roles = [];
// SMTP Configuration Fields (Optional)
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $smtpHost = null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $smtpPort = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $smtpUsername = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $smtpPassword = null;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private ?string $smtpEncryption = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $smtpFromEmail = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $smtpFromName = null;
// Getters and setters...
public function getSmtpHost(): ?string { return $this->smtpHost; }
public function setSmtpHost(?string $smtpHost): self { $this->smtpHost = $smtpHost; return $this; }
public function getSmtpPort(): ?int { return $this->smtpPort; }
public function setSmtpPort(?int $smtpPort): self { $this->smtpPort = $smtpPort; return $this; }
public function getSmtpUsername(): ?string { return $this->smtpUsername; }
public function setSmtpUsername(?string $smtpUsername): self { $this->smtpUsername = $smtpUsername; return $this; }
public function getSmtpPassword(): ?string { return $this->smtpPassword; }
public function setSmtpPassword(?string $smtpPassword): self { $this->smtpPassword = $smtpPassword; return $this; }
public function getSmtpEncryption(): ?string { return $this->smtpEncryption; }
public function setSmtpEncryption(?string $smtpEncryption): self { $this->smtpEncryption = $smtpEncryption; return $this; }
public function getSmtpFromEmail(): ?string { return $this->smtpFromEmail; }
public function setSmtpFromEmail(?string $smtpFromEmail): self { $this->smtpFromEmail = $smtpFromEmail; return $this; }
public function getSmtpFromName(): ?string { return $this->smtpFromName; }
public function setSmtpFromName(?string $smtpFromName): self { $this->smtpFromName = $smtpFromName; return $this; }
}
$user = $this->getUser();
$smtpHost = $user->getSmtpHost();
$smtpPort = $user->getSmtpPort();
// Configure mailer with these settings...
namespace App\Service;
use Webberdoo\InstallerBundle\Service\SchemaInstaller;
class CustomSchemaInstaller extends SchemaInstaller
{
public function install(array $dbCredentials): array
{
$result = parent::install($dbCredentials);
// Add custom logic here
// e.g., seed default data
return $result;
}
}
bash
php bin/console assets:install --symlink