Home > database >  Laravel package inside a package not showing my routes
Laravel package inside a package not showing my routes

Time:12-02

I've got a Laravel 8 project that includes a custom built package called pkg-inbound-management. It's included in my project's root composer file and this package includes a bunch of routes.

I've extended the package to include a new packages folder with a new mini custom package and have included it into the main package's composer file via the repositories section.

The issue I'm facing is that when I run php artisan route:list in my project which includes the package, I don't see the package's package routes. and would like to know what I'm missing.

pkg-inbound-management

{
    "name": "company/pkg-inbound-management",
    "description": "Laravel package for integrating inbound logic into a website",
    "type": "library",
    "version": "1.8.0",
    "keywords": [
        "company",
        "inbounds"
    ],
    "authors": [
        {
            "name": "company",
            "email": "[email protected]"
        }
    ],
    "require": {
        "doctrine/dbal": "^2.10"
    },
    "repositories": [
        {
            "type": "path",
            "url": "./packages/fudge-pkg-inbound-management-bridge"
        }
    ],
    "autoload": {
        "psr-4": {
          "Company\\InboundManagement\\": "src"
        }
    },
    "extra": {
        "laravel": {
            "providers": [
                "Company\\InboundManagement\\InboundManagementServiceProvider"
            ]
        }
    }
}

This package then includes the following:

{
    "name": "company/fudge-pkg-inbound-management-bridge",
    "description": "Fudge Inbound Management Bridge",
    "type": "library",
    "version": "1.0.0",
    "require": {
        "php": "^7.4|^8.0"
    },
    "autoload": {
        "psr-4": {
            "Company\\FudgePkgInboundManagementBridge\\": "src/"
        }
    },
    "config": {
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "providers": [
                "Company\\FudgePkgInboundManagementBridge\\FudgePkgInboundManagementBridgeServiceProvider"
            ]
        }
    }
}

Here's a visualisation of the structure:

enter image description here

The main package, pkg-inbound-management is then included into my project which is where the routes from the bridge package appear to not show up.

CodePudding user response:

try:

php artisan route:clear
php artisan route:list

CodePudding user response:

Assumption the package installed correctly.

You may have your routes cached and need to clear the cache. You can run php artisan route:cache to refresh the cache.

  • Related