@@ -85,6 +85,8 @@ protected function interact(InputInterface $input, OutputInterface $output)
85
85
| |___| (_| | | | (_| |\ V / __/ |
86
86
|______\__,_|_| \__,_| \_/ \___|_|</> ' .PHP_EOL .PHP_EOL );
87
87
88
+ $ this ->ensureExtensionsAreAvailable ($ input , $ output );
89
+
88
90
if (! $ input ->getArgument ('name ' )) {
89
91
$ input ->setArgument ('name ' , text (
90
92
label: 'What is the name of your project? ' ,
@@ -147,6 +149,38 @@ protected function interact(InputInterface $input, OutputInterface $output)
147
149
// }
148
150
}
149
151
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
+
150
184
/**
151
185
* Execute the command.
152
186
*
0 commit comments