PHP code example of ycore / fortify-ui

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

    

ycore / fortify-ui example snippets


    'features' => [
        Features::registration(),
        Features::resetPasswords(),
        //Features::emailVerification(),
        //Features::updateProfileInformation(),
        //Features::twoFactorAuthentication(),
        //Features::twoFactorAuthentication([
            //'confirmPassword' => true,
        //]),
        //Features::updatePasswords(),
    ],

use Laravel\Fortify\TwoFactorAuthenticatable;

class User extends Authenticatable
{
    use HasFactory, Notifiable, TwoFactorAuthenticatable;
    ...

    protected $hidden = [
        'two_factor_recovery_codes',
        'two_factor_secret',
    ];
    ...

'views' => [
    'login' => 'auth.login',
    'register' => 'auth.register',
    'verify-email' => 'auth.verify-email',
    'reset-password' => 'auth.password.reset-password',
    'forgot-password' => 'auth.password.forgot-password',
    'confirm-password' => 'auth.password.confirm-password',
    'two-factor-challenge' => 'auth.password.two-factor-challenge',
    'update-password' => 'profile.update-password',
    'two-factor-authentication' => 'profile.two-factor-authentication',
    'update-profile-information' => 'profile.update-profile-information',
],

...
    public function boot(): void
    {

        Fortify::createUsersUsing(CreateNewUser::class);

        Fortify::loginView(function () {
            return view(config('fortify-ui.views.login'));
        });

        Fortify::confirmPasswordView(function () {
            return view(config('fortify-ui.views.confirm-password'));
        });

        $this->bootFeatures();

    }

...
    protected function bootFeatures(): void
    {
        if (Features::enabled(Features::resetPasswords())) {
            Fortify::resetUserPasswordsUsing(ResetUserPassword::class);

            Fortify::requestPasswordResetLinkView(function () {
                return view(config('fortify-ui.views.forgot-password'));
            });

            Fortify::resetPasswordView(function ($request) {
                return view(config('fortify-ui.views.reset-password'), ['request' => $request]);
            });
        }

        if (Features::enabled(Features::registration())) {
            Fortify::registerView(function () {
                return view(config('fortify-ui.views.register'));
            });
        }

        if (Features::enabled(Features::emailVerification())) {
            Fortify::verifyEmailView(function () {
                return view(config('fortify-ui.views.verify-email'));
            });
        }

        if (Features::enabled(Features::updateProfileInformation())) {
            Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
        }

        if (Features::enabled(Features::updatePasswords())) {
            Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
        }

        if (Features::enabled(Features::twoFactorAuthentication())) {
            Fortify::twoFactorChallengeView(function () {
                return view(config('fortify-ui.views.two-factor-challenge'));
            });
        }
    }
...
bash
$ php artisan fortify:publish --migrations
$ php artisan migrate
bash
$ php artisan fortify:publish --config
bash
$ php artisan fortify:publish --ui-config
bash
$ php artisan fortify:publish --provider