Ben February 2016

Manually attach package to Laravel (unable to use composer due to firewall)

I can't use composer to handle my dependencies due to the corporate firewall. At the moment I'm trying to use Barry vd Heuvel's DomPDF wrapper for Laravel and tried to:

  1. Download the zipfile from Github (master)
  2. Updated composer.json (not sure if its needed, but did it anyway) and added "barryvdh/laravel-dompdf": "*" in the require container.
  3. Create the folder structure: vendor/barryvdh/laravel-dompdf
  4. Place all files from the package in there (config-folder, src-folder and the files .gitignore, composer.json and readme.md)
  5. Add the service provider and facade in my app.php. Service provider is listed as Barryvdh\DomPDF\ServiceProvider::class and the facade is aliased like 'PDF' => Barryvdh\DomPDF\Facade::class
  6. Ran composer dump-autoload

After refreshing the browser I'm getting Class 'Barryvdh\DomPDF\ServiceProvider' not found. I also tried to run php artisan cache:clear and php artisan dump-autoload but the last one fails over the fact it can't find Barryvdh\DomPDF\ServiceProvider.

What have I forgotten to do to make it work?

Update I've tried the suggested answer from Wouter J and the composer.json now looks like:

..
"autoload": {
    "classmap": [
      "database"
    ],
    "psr-4": {
      "App\\": "app/",
      "Barryvdh\\DomPDF\\": "vendor/barryvdh/laravel-dompdf/src"
    },
..

I've verified if the composer dump-autoload had any effect but I think it had. Because the entry is now also listed in vendor/composer/autoload_psr4.php like:

return array(
 // more entries
 'Barryvdh\\DomPDF\\' => array($ven        

Answers


Wouter J February 2016

Composer autoload still doesn't know anything about how to download the package. You have to configure autoloading like this:

{
    "autoload": {
        "psr-4": { "Namespace\\Of\\The\\Package\\": "vendor/the/package" }
    }
}

Post Status

Asked in February 2016
Viewed 1,170 times
Voted 14
Answered 1 times

Search




Leave an answer