AnsweredAssumed Answered

AlfrescoPHP into Symfony2!

Question asked by hamidp on May 16, 2013

I'm new to Alfresco and Symfony2 too, so please be understandable if I'm acting like a noob :D.

So the question is: how to include a AlrescoPhpLib into Symfony project?

I tried different kind of tutorials to include third part libraries into symfony2 but I have always the same error :
FatalErrorException: Error: Class 'Repository' not found
in C:\wamp\www\Projet\src\Hmp\Bundle\Controller\DefaultController.php ligne …

Source tutorial from :

The library is in /vendor/alfresco/lib/Alfresco/src/.
I took the AlfrescoLoader from Ifresco - ClassLoader project to load all classes.

class AlfrescoLoader {
   public static function load($className){
      $directories = array(

      $fileNameFormats = array(

      // this is to take care of the PEAR style of naming classes
      $path = str_ireplace('_', '/', $className);

      if(@include_once $path.'.php'){

      foreach($directories as $directory){
         foreach($fileNameFormats as $fileNameFormat){
            $path = $directory.sprintf($fileNameFormat, $className);
            $pathBefore = "../../".$directory.sprintf($fileNameFormat, $className);
            if(file_exists($path)) {
               include_once $path;
            elseif (file_exists($pathBefore)) {
               include_once $pathBefore;


Then I created a extended class:
# /vendor/alfresco/lib/Alfresco/Alfresco.php

require_once __DIR__.'/src/AlfrescoLoader.php';

class Alfresco extends AlfrescoLoader {

Then I added a Alfreco class to autoload:
       'Alfresco' => __DIR__.'/../vendor/alfresco/lib',

I think, I did it corectly. But unfortunately it doesn't work :(

If someone could help me, I would apreciate it!


P.S: Sorry for my english!