I have been trying this for hours now - and I can't seem to find any posts that work. I am adding custom php classes to the Symfony2 vendor directory.
For example (copied other vendor structure):
vendor/mylib/mylib/src/Mylib/Lib/Class.php
I then updated the root composer.json by adding:
"require": {
"mylib/mylib": "@dev"
},
I also created a composer.json in vendor/mylib/mylib which contained:
{
"name": "mylib/mylib",
"type": "library",
"description": "My Libraty",
"keywords": ["library"],
"autoload": {
"psr-0": { "Mylib\\": "src/" }
},
"minimum-stability": "dev"
}
I have added a namespace in Class.php:
namespace MyLib\Lib;
In one of my bundles I have added the below:
use MyLib\Lib\ClassName as ClassName;
class Cms extends ClassName
{}
The error I am getting is:
FatalErrorException: Error: Class 'MyLib\Lib\MyClass' not found in C:\xampp\htdocs\My_CMS\src\Cms\CmsBundle\Entity\Cms.php line 13
What am I doing wrong?
composer dump-autoloadafter adding your lib to composer.json?