Friday, March 29, 2024
HomePHPCreating Installer Instructions for Laravel Packages

Creating Installer Instructions for Laravel Packages


The Laravel Bundle Instruments bundle by Spatie added a nifty characteristic we wished to assist share with the neighborhood: streamlined set up instructions for Laravel packages.

Usually, when putting in a Laravel neighborhood bundle, the README may have directions for publishing config recordsdata, migrations, and so forth. With Laravel Bundle Instruments, now you can outline a devoted set up command to automate all that:

1$bundle

2 ->identify('your-package')

3 ->hasConfigFile()

4 ->hasInstallCommand(perform(InstallCommand $command) {

5 $command

6 ->publishConfigFile()

7 ->publishMigrations()

8 ->askToRunMigrations()

9 ->copyAndRegisterServiceProviderInApp()

10 ->askToStarRepoOnGitHub();

11 });

Utilizing a devoted set up command, your customers solely have to run one command as an alternative of manually doing on a regular basis set up duties. Utilizing the above bundle identify, that may appear to be:

1php artisan your-package:set up

The set up command characteristic additionally consists of startWith() and endWith() strategies so as to add customized performance to your set up command.

Neat!

To get began with this bundle, take a look at spatie/laravel-package-tools on GitHub. Additionally, take a look at Creating installer instructions for Laravel packages by the creator Freek Van der Herten for background particulars of why this characteristic was added, together with examples.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments