redsquirrelstudio / laravel-backpack-import-operation

An operation to make configurable imports for your CRUDs using the Backpack api you know and love
Other
17 stars 1 forks source link

Can't install for latest Laravel 10.x and PHP 8.2 - Required PHP Extensions are not documented in README #3

Closed gvanto closed 10 months ago

gvanto commented 10 months ago

Hi Lewis,

Tried installing latest with composer, getting following:

image

My composer.json:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The skeleton application for the Laravel framework.",
    "keywords": ["laravel", "framework"],
    "license": "MIT",
    "require": {
        "php": "^8.1",
        "backpack/crud": "^6.4",
        "backpack/theme-tabler": "^1.1",
        "guzzlehttp/guzzle": "^7.2",
        "kitar/laravel-dynamodb": "^1.2",
        "laravel/framework": "^10.10",
        "laravel/sanctum": "^3.3",
        "laravel/tinker": "^2.8"
    },
    "require-dev": {
        "backpack/generators": "^4.0",
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.1",
        "spatie/laravel-ignition": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ],
        "post-install-cmd": ["php artisan storage:link --quiet"]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}
redsquirrelstudio commented 10 months ago

Hi Gvanto,

This looks to be an issue with your system environment as per the error composer has returned. I have successfully installed the latest version of the package while using the above composer.json.

Please install ext-gd as it is required by maatwebsite/excel.

If this still fails, try to force install the latest version of the package by doing

composer require redsquirrelstudio/laravel-backpack-import-operation:1.6.0 -W

Hope this helps!

gvanto commented 10 months ago

Hey @redsquirrelstudio,

Are you using docker?

I have installed GD (and sodium), I can see from phpinfo() that it's installed and enabled. Yet, still getting the below when doing composer require (I don't really want to use -W as I don't want composer downgrading packages)

image

FYI my dockerfile:

FROM php:8.1-fpm-alpine

RUN apk update && \
    apk add \
    bash \
    vim

# https://github.com/mlocati/docker-php-extension-installer
# will install all the required APT/APK packages :-)
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN chmod +x /usr/local/bin/install-php-extensions

RUN install-php-extensions \
    pdo \
    pdo_mysql \
    bcmath \
    gd \
    sodium

RUN curl -sS https://getcomposer.org/installer | php -- \
    --install-dir=/usr/local/bin --filename=composer && \
    composer clear-cache

# The SHELL instruction allows the default shell used for the shell form of commands to be overridden.
# https://riptutorial.com/docker/example/11016/shell-instruction
SHELL ["bash", "-c"]

#php.ini (later - also set php-fpm if needed)
COPY docker/config/php/php.ini /usr/local/etc/php

#Get awesomeness like 'lsh' etc
COPY docker/scripts/.bashrc /root/

WORKDIR /var/www

#Note: composer install needs to run to run post autodump stuff (loading package stuff)
CMD bash -c "composer install && php artisan serve --host=0.0.0.0 --port=9000"

# Keep container alive to log into
#ENTRYPOINT ["tail", "-f", "/dev/null"]
redsquirrelstudio commented 10 months ago

Hi Gvanto,

I agree with your previous issue, I will add the extension requirements to the read me,

Your latest error seems to be you require ext-zip, here is a link to Laravel Excel's installation page which describes the required extensions to help for now:

https://docs.laravel-excel.com/3.1/getting-started/installation.html

Hopefully this allows you to get this installed :)

Many thanks for opening the issue.

gvanto commented 10 months ago

OK got it working now thanks @redsquirrelstudio !