HappyCoder
HappyCoder

Reputation: 6155

ZF2: How to install hybridauth in Zend Framework 2

I seem to be having a problem trying to install hybridauth in my ZF2 application. I have read quite a few similar issues however none of them seem to be able to resolve my issue.

ERROR:

with message 'Module (Hybridauth) could not be initialized.' 

Really not sure what I am doing wrong. Bog standard install of ZendSkeleton.

I am using composer to do the install:

Composer file

    {
    "name": "zendframework/skeleton-application",
    "description": "Skeleton Application for ZF2",
    "license": "BSD-3-Clause",
    "keywords": [
        "framework",
        "zf2"
    ],
    "homepage": "http://framework.zend.com/",
    "require": {
        "php": ">=5.3.3",
        "zendframework/zendframework": "2.3.*",
        "zendframework/zend-developer-tools": "dev-master",
        "doctrine/doctrine-orm-module": "0.8.0",
        "doctrine/orm": "2.4.*",
        "gedmo/doctrine-extensions": "dev-master",
        "zf-commons/zfc-rbac":"~2.3",
        "rwoverdijk/assetmanager": "1.4.1",
        "zfcampus/zf-apigility": "~1.0",
        "zfcampus/zf-apigility-doctrine": "dev-master",
        "hybridauth/hybridauth": "dev-master"
    },
    "require-dev": {
        "zfcampus/zf-apigility-admin": "~1.0",
        "zfcampus/zf-development-mode": "~2.0"
    }
}

Application config includes:

'Hybridauth',

Init Autoloader

// Composer autoloading
if (file_exists('vendor/autoload.php')) {
    $loader = include 'vendor/autoload.php';
}

Vendor Autoload

Autoload.php

 require_once __DIR__ . '/composer' . '/autoload_real.php';
 return ComposerAutoloaderInit23fd7e6840fd3e0a954f3117bc110d81::getLoader();

Composer Autoload Real

   includes: /autoload_namespaces.php, autoload_classmap.php , autoload_files.php

Nmespace includes this

   'Hybrid' => array($vendorDir . '/hybridauth/hybridauth/hybridauth'),

Psr4 and classmap files

    No references to HybridAuth

Upvotes: 0

Views: 771

Answers (2)

Purple Hexagon
Purple Hexagon

Reputation: 3578

Hybridauth isn't a zf2 module so you don't need to include it in application.config.php.

The error:

with message 'Module (Hybridauth) could not be initialized.' 

is due to zf2 trying to load it as a module. You either need to include the classes and write your own integration or you could try https://github.com/SocalNick/ScnSocialAuth which is a zf2 module

Upvotes: 4

GianArb
GianArb

Reputation: 1674

You add autoload config in your composer.json

"autoload": {
    "psr-0": {
        "Hybrid": "./vendor/hybridauth/hybridauth/hybridauth/"
    }
},

Upvotes: 0

Related Questions