Question

I'm trying to add the following two classes:

https://packagist.org/packages/itbz/fpdi
https://packagist.org/packages/itbz/fpdf

I've included them in my composer.json file:

"require-dev": {
        "itbz/fpdi": "dev-master",
        "itbz/fpdf": "1.7.2"
    }

When I try to reference them in my app/config/app.php file like so:

'providers' => array (
    .....
    'itbz\fpdf',
    'itbz\fpdi',
),

'aliases' => array (
    .....
    'Fpdf'            => 'itbz\fpdf\Facades\Fpdf',
    'Fpdi'            => 'itbz\fpdi\Facades\Fpdi',

),

I get a 'class not found' error when I run composer install for both.

I've done composer update after I've included the require-dev information in composer.json, so I believe the errors are in my referencing of the two classes in app/config/app.php. I don't know how to reference them, so if someone is able to help that would be great.

Was it helpful?

Solution

Have you done a rebuild of your autoloads?

composer dump-autoload

After that is done, I believe you should be able to just use the classes without use first.

EDIT: I don't know these packages but I am not sure they include the Facade classes you mention. Facades are very specific to Laravel 4.

I believe if you remove the aliases then this should work OK:

'Fpdf'            => 'itbz\fpdf\Facades\Fpdf',
'Fpdi'            => 'itbz\fpdi\Facades\Fpdi',

if you want to then use these classes in your app, you would say:

$fpdi = new \fpdi\FPDI();
$fpdf = new \fpdf\FPDF();

or something like that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top