sopinet/autologin-bundle

该包最新版本(dev-master)没有可用的许可证信息。

Symfony AutologinBundle

安装: 115

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 11

分支: 0

开放问题: 1

类型:symfony-bundle

dev-master 2015-08-12 07:57 UTC

This package is not auto-updated.

Last update: 2024-09-14 13:57:39 UTC


README

当你通过电子邮件收到通知、邀请等包含您网站URL的链接时,你每次都必须登录。使用此模块,当你点击URL时,你将自动登录,这太简单了。快来试试吧!

先决条件

此模块与FOSUserBundle(查看文档)兼容

安装

composer.json

$ php composer.phar require sopinet/autologin-bundle 'dev-master'

AppKernel.php

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Sopinet\AutologinBundle\SopinetAutologinBundle(),
    );
}

config.yml

# app/config/config.yml
sopinet_autologin:
    domain: http://domain.com

routing.yml

# app/config/routing.yml
sopinet_autologin:
    resource: "@SopinetAutologinBundle/Resources/config/routing.yml"
    prefix:   /

如何使用

生成URL

<?php
$url = $this->container->get('urlhelper')->generateUrl($route, $user);

$message = \Swift_Message::newInstance()
		->setSubject(...)
		->setFrom(...)
		->setTo(...)
		->setBody($this->container->get('templating')->render('your_template.html.twig', array('url' => $url)), 'text/html');