简体   繁体   中英

Developing Laravel Package - How to access artisan commands

I have been working on a new Laravel package where I've manually created the directory structure then manually make the controllers and then add my package into a main laravel 8 project which all works fine but when developing the package you don't have access to the artisan commands to quickly scaffold some of the code.

Plus the IDE (PHP Storm in my case) doesn't know what any of the laravel methods are so it thinks the code is wrong and there's no auto complete available and you don't have access to the artisan command to automatically scaffold controllers, requests migrations etc, so you lose a lot of the benefits of Laravel and the IDE when developing a package.

Is there a way to add something to the package and/or the IDE to make this functionality available. I've looked at the package scaffolders available at https://laravelpackage.com/#tools-and-helpers but they all seem to be somewhat broken, or just create the basic directory structure and not provide the artisan commands or using old versions of Laravl or PHP 7. I am using Laravel 8 and PHP 8.

For comfortably package developing you need Orchestra Testbench

Just install it with --dev and you can access to all laravel features in development process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM