When developing Laravel packages, can you use other Laravel packages in one Laravel package?

how do I use a laravel package such as l5-repository ( https://packagist.org/package.) when developing a laravel package myself?

We can use composer require to come in, but how do we register ServiceProvider in the package?

Mar.01,2021

Laravel 5.5 begins to support automatic package discovery, so you can use other Laravel packages within packages you develop.
so you just need composer require to come in.


Yes, take a look at the composer.json configuration file of this project
https://github.com/sunshinev/.

.
"require": {
        "sebastian/diff": "^3.0",
        "sunshinev/laravel-fe-render":"^1.0",
        "doctrine/dbal": "^2.10"
    },
    "require-dev": {
        "phpunit/phpunit": "^8.0",
        "orchestra/testbench": "^3.8|^4.0"
    },

this allows you to automatically load other extensions that the extension package depends on when the package is introduced into the main project

Menu