Reputation: 2683
I have THIS package (a payment gateway), which I would like to use in Symfony 3.0.1 Unfortunately I get this error:
ClassNotFoundException in AppKernel.php line 21: Attempted to load class "SofortBundle" from namespace "Sofort\SofortLib". Did you forget a "use" statement for another namespace?
In the sofort\sofortlib-php
folder i created the file SofortBundle.php
with this content
<?php
namespace Sofort\SofortLib;
use Symfony\Component\HttpKernel\Bundle\Bundle as BaseBundle;
class SofortBundle extends BaseBundle
{
}
and I loaded the Bundle in AppKernel.php
:
new Sofort\SofortLib\SofortBundle(),
But that only leads to above exception.
What am I missing?
Upvotes: 0
Views: 108
Reputation: 5542
Don't copy packages to your custom folder. Install package as described:
In composer.json
add:
"require": {
"sofort/sofortlib-php": "3.*"
}
Run composer update sofort/sofortlib-php
In your code you can use the library like this:
use \Sofort\SofortLib\Billcode;
class MyClass
{
function doSomething($configkey) {
$SofortLibBillcode = new Billcode($configkey);
...
}
}
Upvotes: 2