inklings.io/laravel-indieauth-client

Laravel indieauth 基础认证的扩展包

0.1.2 2017-06-07 02:18 UTC

This package is not auto-updated.

Last update: 2024-09-15 01:40:34 UTC


README

Laravel-IndieAuth-Client 扩展包提供了一个简单的表单字段,允许用户通过 indieauth 登录到您的网站。

安装

首先运行 composer require inlings.io/laravel-indieauth-client 来获取供应商库。

然后将其添加到您的 config/app.php 中的 providers 和 aliases。

<?php 

    'providers' => [
    
    ...

        Inklings\IndieAuth\IndieAuthClientServiceProvider::class,
    
    ...

    'aliases' => [

    ...

        'IndieAuth' => Inklings\IndieAuth\Helpers::class,

    ...

    ],

?>

添加到模板

现在您可以在模板中直接添加登录/注销表单

{!! IndieAuth::login_logout_form() !!}

还有 login_form()logout_form() 函数。

如果用户当前已登录,您可以添加已登录行。

    @if (IndieAuth::is_logged_in())
        <div>Logged In As: {!! IndieAuth::user() !!}</div>
    @endif

您可以通过使用 vendor:publish 命令来自定义模板

任何结果都将存储在 session('error') 或 session('success') 中;

查看 src/Helpers.php 以查看 IndieAuth 下所有可用的函数: