plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Bug]: Laravel IDEA not running on a Laravel Zero project

Open eleftrik opened this issue 1 year ago • 5 comments

Bug description

I have a Laravel Zero application; Laravel menu is not showing in PHPStorm.

I think because laravel-zero/framework is a require-dev dependency (while usually it's under require). I need to have it under require-dev because I have to build a standalone application, as reported in the Laravel Zero documentation.

Could you please enable Laravel IDEA even when this dependency is under require-dev?

Thank you.

Plugin version

8.0.3.233

Operating system

MacOS

Steps to reproduce

Move laravel-zero/framework dependency under require-dev in composer.json, run composer update, restart PHPStorm.

Relevant log output

None.

eleftrik avatar Jan 20 '24 15:01 eleftrik

It will work with laravel-zero/framework.

First it searches packages in composer.lock. If there is no composer.lock file - in vendor/composer/installed.json. If there is no this file - in composer.json both in require and require-dev.

So, you probably installed the packages with --no-dev option? And there is no laravel-zero/framework package in your vendor?

adelf avatar Jan 20 '24 21:01 adelf

@adelf thanks for the quick reply! No, I didn't use --no-dev option.

If I run from the root of my project:

composer show laravel-zero/framework --installed --version

I got Composer version 2.5.5 2023-03-21 11:50:05

My package.json:

{
    "name": "encodia/edit-cli",
    "description": "Encodia Development Internal Tools",
    "keywords": [
        "framework",
        "laravel",
        "laravel zero",
        "console",
        "cli",
        "edit",
        "edit-cli"
    ],
    "homepage": "https://www.encodia.it",
    "type": "project",
    "license": "MIT",
    "support": {
        "issues": "https://github.com/encodia/edit-cli/issues",
        "source": "https://github.com/encodia/edit-cli"
    },
    "authors": [
        {
            "name": "Erik D'Ercole",
            "email": "[email protected]"
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.encodia.dev"
        }
    ],
    "require": {
        "php": "^8.2"
    },
    "require-dev": {
        "encodia/laravel-dotenv-editor": "^2.1",
        "guzzlehttp/guzzle": "^7.8.1",
        "illuminate/hashing": "^10.41.0",
        "illuminate/http": "^10.41.0",
        "illuminate/translation": "^10.41",
        "laminas/laminas-text": "^2.11",
        "larastan/larastan": "^2.8.1",
        "laravel-zero/framework": "^10.3.0",
        "laravel/pint": "^1.13.9",
        "mockery/mockery": "^1.6.7",
        "nunomaduro/mock-final-classes": "^1.2",
        "nunomaduro/termwind": "^1.15.1",
        "pestphp/pest": "^2.31.0",
        "pestphp/pest-plugin-type-coverage": "^2.8",
        "spatie/laravel-data": "^3.11"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Domain\\": "Domain/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        },
        "files": [
            "constants/constants.php",
            "constants/dev.php",
            "constants/laravel.php",
            "constants/wp.php",
            "Domain/Start/Support/Helpers/Configuration.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true
        }
    },
    "scripts": {
        "analyse": "XDEBUG_MODE=off ./vendor/bin/phpstan analyse --memory-limit 2G --ansi",
        "format": "vendor/bin/pint --dirty --ansi",
        "test": "XDEBUG_MODE=off ./vendor/bin/pest --parallel --bail --exclude-group=API,S3 --colors=always",
        "test-coverage": "./vendor/bin/pest --parallel --bail --exclude-group=API,S3 --coverage --min=75 --colors=always",
        "type-coverage": "./vendor/bin/pest --type-coverage"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "bin": [
        "builds/edit"
    ]
}

I have no "Laravel" menu showing in the toolbar:

image

Thank you

eleftrik avatar Jan 21 '24 06:01 eleftrik

If I move laravel-zero/framework dependency from require to require-dev and I run composer update, after reindexing, PHPStorm shows Laravel menu:

image

eleftrik avatar Jan 21 '24 06:01 eleftrik

I've found a bug and fixed it. There is a "packages-dev" key in the composer.lock file. I thought there is only a "packages". As a workaround, you can turn the plugin on manually:

image

adelf avatar Jan 21 '24 10:01 adelf

Thank you very much @adelf!

eleftrik avatar Jan 21 '24 14:01 eleftrik