Search code examples
symfonyvendor

add your own library in a symfony project


I asked a similar questions before but had no right answers. Maybe I did not explain good.

I have 2 classes of my own that I would like to add in symfony project.

seculibs/collections/A.php and seculibs/collections/B.php (it is not on github, it is local).

I would like to add my seculibs folder in the vendor folder and ask symfony to load the classes.

Obviously everything happens in app/autoload.php

I thought that doing this would be okay but not :

$loader->add('seculibs/collections',__DIR__ . '/../vendor/seculibs/collections/');

it still cannot find the classes.

Can somebody tell me exactly what to do? I am with Symfony 2.3.6

Please do not refer to composer.json neither to the UniversalClassLoader and its registerNamespaces method as this is not the class I am dealing with in this autoload.php


Solution

  • So I found the right syntax... It will help some others

    $loader->add('seculibs\\collections',__DIR__ . '/../vendor');