ollyxar/laravel-auth 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ollyxar/laravel-auth

Composer 安装命令:

composer require ollyxar/laravel-auth

包简介

Laravel auth helper

README 文档

README

Version Downloads License

Get user's id from session identified by cookie

Why auth helper?

Auth helper designed for external PHP application authentication. It helps developers to get user_id from their session without any auth-token or any authorize process.

How it's work?

Suppose you have some PHP server application that need to know who is making request. It can be some artisan command requiring authorization or WebSocket server in another port that is listening connections.

In the browser user go to some address (obviously it must have the same domain). Thus browser sends current headers to your application. And then you can use Cookie from the headers to define client.

License

Example

Here is a simple example how to determine user_id

// if the sessions are in files by default
use Ollyxar\LaravelAuth\FileAuth;

// or if the sessions in the Redis
// use Ollyxar\LaravelAuth\RedisAuth;

// The same code for Redis except you have to call RedisAuth instead
if ($userId = FileAuth::getUserIdByHeaders($headers)) {
    // we got it!
}

You have to provide correct $headers array that must content Cookie item. Otherwise $user_id will return false

The headers should be like:

$headers = [
    'Cookie' => 'someotherkey=someothervalue;laravel_session=somerandomstring'
];

Please notice that auth helper use the same native methods / functions to find session by cookie.

统计信息

  • 总下载量: 931
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固