I need to catch only these PHP extensions that are necessary for the app to work. The idea is removing all the PHP extensions that are not necessary for the app. Do you guys have any idea how can I do that?
The app is on PHP 8.0.14 - Laravel 8
I need to catch only these PHP extensions that are necessary for the app to work. The idea is removing all the PHP extensions that are not necessary for the app. Do you guys have any idea how can I do that?
The app is on PHP 8.0.14 - Laravel 8
I am not sure what is the question. Try this code:
$full = explode("-", "PHP 8.0.14 - Laravel 8"); // first argument is separator, in your case it's "-" sign, second argument is what needs to be separated
$extension =end($full); //gives everithing after "-" sign
$noextension = reset($full); //gives everithing before "-" sign
I think you need one of those.
Take a look at this project: https://github.com/maglnet/ComposerRequireChecker
It does what you are asking, based both in the dependencies you required through composer and on the code you wrote.
You can use it by running composer-require-checker check <path/to/composer.json>
The output will be something like this:
$ composer-require-checker check composer.json
ComposerRequireChecker 4.1.x-dev@fb2a69aa2b7307541233536f179275e99451b339
The following 2 unknown symbols were found:
+----------------------------------------------------------------------------------+--------------------+
| Unknown Symbol | Guessed Dependency |
+----------------------------------------------------------------------------------+--------------------+
| hash | ext-hash |
| Psr\Http\Server\RequestHandlerInterface | |
+----------------------------------------------------------------------------------+--------------------+
By looking at it you can tell that I must include ext-hash
and psr/http-server-handler
to my composer's require
section.
Note that although ext-hash
has been shipped with standard PHP distributions for a while, it may be a good practice to include it, so if your software is being executed in a non-standard/custom distribution.