@@ -56,6 +56,7 @@ protected function configure()
5656 ->addOption ('pest ' , null , InputOption::VALUE_NONE , 'Install the Pest testing framework ' )
5757 ->addOption ('phpunit ' , null , InputOption::VALUE_NONE , 'Install the PHPUnit testing framework ' )
5858 ->addOption ('npm ' , null , InputOption::VALUE_NONE , 'Install and build NPM dependencies ' )
59+ ->addOption ('using ' , null , InputOption::VALUE_OPTIONAL , 'Install a custom starter kit from a community maintained package ' )
5960 ->addOption ('force ' , 'f ' , InputOption::VALUE_NONE , 'Forces install even if the directory already exists ' );
6061 }
6162
@@ -108,7 +109,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
108109 );
109110 }
110111
111- if (! $ input -> getOption ( ' react ' ) && ! $ input-> getOption ( ' vue ' ) && ! $ input -> getOption ( ' livewire ' )) {
112+ if (! $ this -> usingStarterKit ( $ input )) {
112113 match (select (
113114 label: 'Which starter kit would you like to install? ' ,
114115 options: [
@@ -125,7 +126,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
125126 default => null ,
126127 };
127128
128- if ($ this ->usingStarterKit ($ input )) {
129+ if ($ this ->usingLaravelStarterKit ($ input )) {
129130 match (select (
130131 label: 'Which authentication provider do you prefer? ' ,
131132 options: [
@@ -148,7 +149,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
148149 }
149150 }
150151
151- if ($ this ->usingStarterKit ($ input )) {
152+ if ($ this ->usingLaravelStarterKit ($ input )) {
152153 if (! $ input ->getOption ('phpunit ' ) &&
153154 ! $ input ->getOption ('pest ' )) {
154155 $ input ->setOption ('pest ' , select (
@@ -226,22 +227,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int
226227
227228 $ createProjectCommand = $ composer ." create-project laravel/laravel \"$ directory \" $ version --remove-vcs --prefer-dist --no-scripts " ;
228229
229- $ stackSlug = match (true ) {
230- $ input ->getOption ('react ' ) => 'react ' ,
231- $ input ->getOption ('vue ' ) => 'vue ' ,
232- $ input ->getOption ('livewire ' ) => 'livewire ' ,
233- default => null
234- };
230+ $ starterKit = $ this ->getStarterKit ($ input );
235231
236- if ($ stackSlug ) {
237- $ createProjectCommand = $ composer ." create-project laravel/ $ stackSlug -starter-kit \"$ directory \" --stability=dev " ;
232+ if ($ starterKit ) {
233+ $ createProjectCommand = $ composer ." create-project { $ starterKit } \"{ $ directory} \" --stability=dev " ;
238234
239- if ($ input ->getOption ('livewire-class-components ' )) {
240- $ createProjectCommand = str_replace (" laravel/ { $ stackSlug } -starter-kit " , " laravel/ { $ stackSlug } -starter-kit :dev-components " , $ createProjectCommand );
235+ if ($ this -> usingLaravelStarterKit ( $ input ) && $ input ->getOption ('livewire-class-components ' )) {
236+ $ createProjectCommand = str_replace (" { $ starterKit } " , " { $ starterKit } :dev-components " , $ createProjectCommand );
241237 }
242238
243- if ($ input ->getOption ('workos ' )) {
244- $ createProjectCommand = str_replace (" laravel/ { $ stackSlug } -starter-kit " , " laravel/ { $ stackSlug } -starter-kit :dev-workos " , $ createProjectCommand );
239+ if ($ this -> usingLaravelStarterKit ( $ input ) && $ input ->getOption ('workos ' )) {
240+ $ createProjectCommand = str_replace (" { $ starterKit } " , " { $ starterKit } :dev-workos " , $ createProjectCommand );
245241 }
246242 }
247243
@@ -591,7 +587,7 @@ protected function installPest(string $directory, InputInterface $input, OutputI
591587 $ this ->phpBinary ().' ./vendor/bin/pest --init ' ,
592588 ];
593589
594- if ($ input -> getOption ( ' react ' ) || $ input-> getOption ( ' vue ' ) || $ input -> getOption ( ' livewire ' )) {
590+ if ($ this -> usingStarterKit ( $ input )) {
595591 $ commands [] = $ composerBinary .' require pestphp/pest-plugin-drift --dev ' ;
596592 $ commands [] = $ this ->phpBinary ().' ./vendor/bin/pest --drift ' ;
597593 $ commands [] = $ composerBinary .' remove pestphp/pest-plugin-drift --dev ' ;
@@ -611,15 +607,15 @@ protected function installPest(string $directory, InputInterface $input, OutputI
611607 $ directory .'/tests/Unit/ExampleTest.php ' ,
612608 );
613609
614- if ($ input -> getOption ( ' react ' ) || $ input-> getOption ( ' vue ' ) || $ input -> getOption ( ' livewire ' )) {
610+ if ($ this -> usingStarterKit ( $ input )) {
615611 $ this ->replaceInFile (
616612 './vendor/bin/phpunit ' ,
617613 './vendor/bin/pest ' ,
618614 $ directory .'/.github/workflows/tests.yml ' ,
619615 );
620616 }
621617
622- if (( $ input -> getOption ( ' react ' ) || $ input-> getOption ( ' vue ' ) || $ input -> getOption ( ' livewire ' ) ) && $ input ->getOption ('phpunit ' )) {
618+ if ($ this -> usingStarterKit ( $ input ) && $ input ->getOption ('phpunit ' )) {
623619 $ this ->deleteFile ($ directory .'/tests/Pest.php ' );
624620 }
625621
@@ -747,6 +743,28 @@ protected function generateAppUrl($name)
747743 return $ this ->canResolveHostname ($ hostname ) ? 'http:// ' .$ hostname : 'http://localhost ' ;
748744 }
749745
746+ /**
747+ * Get the starter kit repository, if any.
748+ */
749+ protected function getStarterKit (InputInterface $ input ): ?string
750+ {
751+ return match (true ) {
752+ $ input ->getOption ('react ' ) => 'laravel/react-starter-kit ' ,
753+ $ input ->getOption ('vue ' ) => 'laravel/vue-starter-kit ' ,
754+ $ input ->getOption ('livewire ' ) => 'laravel/livewire-starter-kit ' ,
755+ default => $ input ->getOption ('using ' ),
756+ };
757+ }
758+
759+ /**
760+ * Determine if a Laravel first-party starter kit has been chosen.
761+ */
762+ protected function usingLaravelStarterKit (InputInterface $ input ): bool
763+ {
764+ return $ this ->usingStarterKit ($ input ) &&
765+ str_starts_with ($ this ->getStarterKit ($ input ), 'laravel/ ' );
766+ }
767+
750768 /**
751769 * Determine if a starter kit is being used.
752770 *
@@ -755,7 +773,7 @@ protected function generateAppUrl($name)
755773 */
756774 protected function usingStarterKit (InputInterface $ input )
757775 {
758- return $ input ->getOption ('react ' ) || $ input ->getOption ('vue ' ) || $ input ->getOption ('livewire ' );
776+ return $ input ->getOption ('react ' ) || $ input ->getOption ('vue ' ) || $ input ->getOption ('livewire ' ) || $ input -> getOption ( ' using ' ) ;
759777 }
760778
761779 /**
0 commit comments