0

How i can add adLDAP library to LARAVEL 4 ?

http://adldap.sourceforge.net/

Terry Gardner
  • 10,957
  • 2
  • 28
  • 38
  • Create a libraries folder and add it there, then add this libraries path to the `classmap` in `composer.json`? – SamV Nov 08 '13 at 17:25

2 Answers2

2

That library does not offer a composer.json file yet, you you have to create the necessary information yourself.

I have created a sample file that successfully downloaded something that looks good, but I haven't used the code.

{
    "require": {
        "adldap/adldap": "4.0.4"
    },
    "repositories" : [
        {
            "type": "package",
            "package": {
            "name" : "adldap/adldap",
                "version": "4.0.4",
                "dist": {
                    "url": "http://sourceforge.net/projects/adldap/files/adLDAP/adLDAP_4.0.4/adLDAP_4.0.4r2.zip/download",
                    "type": "zip"
                },
                "source": {
                "url":"https://svn.code.sf.net/p/adldap/code/",
                    "type": "svn",
                    "reference": "tags/v4.0.4/"
                },
                "autoload": {
                    "classmap": ["src/"]
                }
            }
        }
    ]
}

You'd have to create one repositories entry per version you are about to use (one entry is enough if you don't plan do something fancy). I created the entry for the most recent version 4.0.4 - if there is an update, you have to change the version tags everywhere.

The require entry should be added to whatever you are already using.

The distribution URL is a rough guess by following the download link to the ZIP file offered on Sourceforge, bypassing any ad-filled download page. It might stop working unexpectedly. If you delete the whole dist section, you will checkout from the original SVN repository instead, which might be slower than downloading and unpacking a ZIP file.

After that, you are all set with the Composer part. The remaining thing is to include Composer autoloading in the Laravel bootstrapping (you might already have that done), and then enjoy the LDAP classes.

Sven
  • 69,403
  • 10
  • 107
  • 109
1

Anyone coming across this in the future, adLDAP has a composer file now and can easily be autoloaded.

"require": {
    "adldap/adldap": "4.0.*"
},

Then load the library in your controller:

$ldap = new \adLDAP\adLDAP($config);
akahunahi
  • 1,782
  • 23
  • 21