@@ -85,6 +85,8 @@ protected function interact(InputInterface $input, OutputInterface $output)
8585 | |___| (_| | | | (_| |\ V / __/ |
8686 |______\__,_|_| \__,_| \_/ \___|_|</> ' .PHP_EOL .PHP_EOL );
8787
88+ $ this ->ensureExtensionsAreAvailable ($ input , $ output );
89+
8890 if (! $ input ->getArgument ('name ' )) {
8991 $ input ->setArgument ('name ' , text (
9092 label: 'What is the name of your project? ' ,
@@ -147,6 +149,38 @@ protected function interact(InputInterface $input, OutputInterface $output)
147149 // }
148150 }
149151
152+ /**
153+ * Ensure that the required PHP extensions are installed.
154+ *
155+ * @param \Symfony\Component\Console\Input\InputInterface $input
156+ * @param \Symfony\Component\Console\Output\OutputInterface $output
157+ * @return void
158+ *
159+ * @throws \RuntimeException
160+ */
161+ protected function ensureExtensionsAreAvailable (InputInterface $ input , OutputInterface $ output ): void
162+ {
163+ $ availableExtensions = get_loaded_extensions ();
164+
165+ $ missingExtensions = collect ([
166+ 'ctype ' ,
167+ 'filter ' ,
168+ 'hash ' ,
169+ 'mbstring ' ,
170+ 'openssl ' ,
171+ 'session ' ,
172+ 'tokenizer ' ,
173+ ])->reject (fn ($ extension ) => in_array ($ extension , $ availableExtensions ));
174+
175+ if ($ missingExtensions ->isEmpty ()) {
176+ return ;
177+ }
178+
179+ throw new \RuntimeException (
180+ sprintf ('The following PHP extensions are required but are not installed: %s ' , $ missingExtensions ->join (', ' , ', and ' ))
181+ );
182+ }
183+
150184 /**
151185 * Execute the command.
152186 *
0 commit comments