R
R
Roman2017-10-27 07:19:38
Composer
Roman, 2017-10-27 07:19:38

How to properly include new libraries in Laravel app.php?

Good afternoon.
I connect fpdf and fpdi to the project via composer.json:

"require": {
        ...
        "setasign/fpdf": "^1.8",
        "setasign/fpdi": "^2.0"
    },

After in the project folder: Setasign library files were loaded into the vendor folder:
composer update
/ vendor
/setasign/fpdf /fpdf.php
/vendor/setasign/fpdi /src/Fpdi.php
Then I go to app.php and there I have a question:
// config/app.php

return [
    //...
    
    'providers' => [
        // ...
        Setasign\Fpdf\Fpdf::class, // И вот тут я не могу разобраться как правильно прописать
        Setasign\Fpdi\src\Fpdi::class, 
    ],
    
    // ...
    
    'aliases' => [
        // ...
        'Fpdf' => Setasign\Fpdf\Facades\Fpdf::class, // И вот тут я не могу разобраться как правильно прописать
        'Fpdi' => Setasign\Fpdi\Facades\Fpdi::class,
]

Tell me how these lines are formed correctly, I will be glad for any documentation page thrown in my face.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Gerasimov, 2017-10-27
@xii

providers and aliases are a provider and a facade for a component that is written for Lara, if you install something that was not written for Lara, then you simply install it with a composer and pull it in the right place:

use Setasign\Fpdf\Fpdf;
$pdf = new Fpdf() ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question