PHP code example of preflow / members

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

    

preflow / members example snippets


  'aliases' => ['members' => 'sqlite'],
  

  'guards' => [
      'members' => [
          'class' => Preflow\Auth\SessionGuard::class,
          'provider' => 'members',
          'population' => 'members',
          'remember' => ['cookie' => 'site_member', 'days' => 30, 'path' => '/'],
      ],
  ],
  'providers' => [
      'members' => [
          'class' => Preflow\Folio\Users\RecordUserProvider::class,
          'type' => 'member', 'email' => 'email', 'password' => 'password_hash', 'roles' => 'roles',
      ],
  ],
  // Sessions (and their cookie) only where they are needed: Folio and the member pages.
  'session' => ['cookie' => 'site_session', 'paths' => ['/folio', '/members']],
  

return [
    'path' => '/members',                       // base path of the member pages
    'landing' => null,                          // where sign-in lands; null = path
    'register' => null,                         // where the pages link for registering; null = path/register
    'layout' => '@folio/frontend/_site.twig',   // the layout the member pages extend
    'mail' => ['from_name' => null, 'layout' => '@members/mail/layout.twig', 'accent' => '#d42a34'],
    'admission' => Preflow\Members\Admission\OwnerApproval::class,
    'throttle' => ['login' => [10, 900], 'register' => [5, 3600], 'forgot' => [5, 3600], 'resend' => [3, 3600]],
    'password_min' => 10,
    'confirm_ttl' => 86400,
    'reset_ttl' => 3600,
    'retention' => ['unconfirmed_days' => 7, 'declined_days' => 30],
    'privacy_url' => '',                        // the consent's privacy link: one URL or ['en' => '/privacy', 'de' => '/de/datenschutz']
];

interface Admission
{
    public function validate(array $input, ServerRequestInterface $request, array $baseErrors): array; // field => message
    public function recordValues(array $input): array;                                // stored on the member
    public function afterConfirm(DynamicRecord $member, ServerRequestInterface $request): Decision; // Accept or Pending
    public function confirmNotice(DynamicRecord $member): ?string;                   // a line after confirming, or null
    public function details(DynamicRecord $member, string $for): array;              // label => value
}

// lang/de/members.php
return ['mail' => ['confirm' => ['subject' => 'Bitte bestätige deine Adresse']]];

composer low folio:extensions:enable rbac
php preflow folio:extensions:enable members
php preflow migrate
php preflow folio:extensions:apply