Download the PHP package fschwaiger/laravel-ldap without Composer

On this page you can find all versions of the php package fschwaiger/laravel-ldap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-ldap

Simple LDAP Integration for Laravel 5

This module provides a simple user provider for Laravel's auth system that connects to an LDAP server, imports users and groups and then maps the group identifiers to privilege roles in a config file.

This extension is originally written for use in a couple of webservices for Fachschaft Maschinenbau e.V., but is generic enough to be used in a variety of other projects as well. My focus here is to really keep the logic as simple as possible, this is why I stripped all unnecessary properties and methods.

Installation

First, import the package into your laravel project via composer:

Second, copy and paste this line to add its service provider to config/app.php:

Last, publish the config files and migrations to your project with php artisan vendor:publish. This will create the following files:

Integration

To tell Laravel to use this module for providing users, go to config/auth.php and replace the user provider driver eloquent for ldap:

Your App\User class should then inherit from Fschwaiger\Ldap\User. The same goes for your group model, should you choose to extend it. It is up to you to add the Notifiable trait.

To connect to your directory server, edit the file config/ldap.php to match your setup. Simply follow the instructions present in the config file.

Finally, edit your .env file to include:

If you did not modify the default migration for the users table, migration should work out of the box. Else make sure you review the migration changes first.

Once the setup is complete, the following command should import all your user groups.

Importing Users and Groups

With above setup, login should now use the LDAP server instead of the local database to authenticate users. This imports unknown users on their first successful login on-the-fly. Note that importing users does NOT import groups automatically! This means that you need to run ldap:import-users every time your groups change.

Option A: Import manually after changes with php artisan ldap:import-groups. This is good enough for mostly static directory structures. If your groups change more often, check out Option B.

Option B: Schedule the import in app/Console/Kernel.php:

Authorize Actions with Group Privileges

The privileges you define in config/privileges.php are automatically mapped to the authorization gate, so that you can check for them in all parts of your application.

In code:

Using middleware:

In Blade files:


All versions of laravel-ldap with dependencies

PHP Build Version
Package Version
Requires symfony/ldap Version ^3.2
laravel/framework Version ^5.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fschwaiger/laravel-ldap contains the following files

Loading the files please wait ....