ohffs/simple-laravel-ldap
Composer 安装命令:
composer require ohffs/simple-laravel-ldap
包简介
Basic LDAP auser auth/lookup
README 文档
README
WIP
Simple LDAP package for Laravel
This is a very, very simple and very specific LDAP package. It's really just a wrapper of code I usually copy from project to project to do LDAP lookups of our local LDAP server, so it's usefulness outside of that is probably quite limited. But it might be useful as a basis for your own setup.
Installation
composer require ohffs/simple-laravel-ldap
I'm assuming this is for Laravel 5.5+ so it should auto-discover the service providers. You can then publish the config file :
php artisan vendor:publish
And pick the 'Ohffs\Ldap\LdapServiceProvider' option which will create a config/ldap.php file. This
just looks for two env variables which you should set - LDAP_SERVER and LDAP_OU eg,
LDAP_SERVER=ldap.your-domain.com
LDAP_OU=Staff
Usage
You can use the facade to access the main methods :
if (\Ldap::authenticate('username', 'password')) {
// whatever
}
$user = \Ldap::findUser('jenny123');
dump($user);
/*
Ohffs\Ldap\LdapUser {#739
#username: "jenny123"
#email: "Jenny@example.com"
#surname: "Smith"
#forenames: "Jenny"
#phone: "012345678"
}
*/
print $user['email'];
// 'Jenny@example.com'
print $user->email;
// 'Jenny@example.com'
print $user->toArray();
/*
[
"username" => "jenny123",
"email" => "Jenny@example.com",
"surname" => "Smith",
"forenames" => "Jenny",
"phone" => "012345678",
]
*/
Or if you want to use the container/DI just typehint on 'Ohffs\Ldap\LdapService':
use Ohffs\Ldap\LdapService;
public function __construct(LdapService $ldap)
{
$this->ldap = $ldap;
}
public function something()
{
if ($this->ldap->authenticate('username', 'password')) {
// ...
}
}
ohffs/simple-laravel-ldap 适用场景与选型建议
ohffs/simple-laravel-ldap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.69k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 12 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ohffs/simple-laravel-ldap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ohffs/simple-laravel-ldap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-06