Search code examples
laravel-5php-7.0

Unable to download any pdf packages via composer for larvel 5.5


i am using laravel 5.5 with php 7.0 version, I want to generate a pdf, i tried to install many pdf packages, but unable to install because of php 7.0 version, it requires min 7.1 to install any packages, i tried to find packages for 7.0 verision, but failed. can anyone help me how to install package for php 7.0 veriosn

Below is the error, that i am getting,

Your requirements could not be resolved to an installable set of packages. Problem 1 - nwidart/laravel-modules 4.1.0 requires php >=7.1 -> your PHP version (7.0.33) does not satisfy that requirement.


Solution

  • There are only 2 solutions out of this, You either upgrade your PHP version to 7.1 or downgrade your package versions which uses PHP7.0

    If you tell me what packages are you using,I could help you out find the packages. Let me know what your use case is exactly, or why your cant upgrade to PHP7.1

    Also it is important to note that PHP7.0 includes security vulnerabilities fixed in PHP7.1, So consider upgrading your framework to at-least Laravel 5.8

    Edit:

    here is a package for pdp utilities in laravel 5.5 -> https://github.com/niklasravnsborg/laravel-pdf

    For laravel5.5 you will have to manually link the packages as auto discovery will not work.


    Edit 2:

    here is the problem, When you use composer require barryvdh/laravel-dompdf the composer installs the latest package which is 0.8.4 (compatible with PHP7.1 and higher), What you need to do instead is add the package manually to the composer file and then bind the version 0.8.3 like this under the require object -> "barryvdh/laravel-dompdf": "0.8.3" and then run composer update/install in the terminal