symfony/polyfill-php80
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The Symfony polyfill-php80 is a crucial package that provides features to lower PHP versions that were initially added to PHP 8.0 core. This backporting ensures the seamless operation of these features in previous versions. The features include the Stringable interface, fdiv, the ValueError and UnhandledMatchError classes, FILTER_VALIDATE_BOOL constant, get_debug_type, PhpToken class, preg_last_error_msg, among others such as str_contains, str_starts_with, str_ends_with, and get_resource_id.
Utilizing the symfony/polyfill-php80 is remarkably uncomplicated; first, install the package using composer. Input this command into your terminal:
composer require symfony/polyfill-php80
After successful installation, you can now access PHP 8.0 features in your lower PHP version. For instance:
if (str_contains('example', 'ex')) {
echo "The string 'ex' was found in the string 'example'!";
}
This example uses the str_contains
check, a feature added in PHP 8.0.
Symfony/polyfill-php80 does not have standalone documentation. However, you can find more valuable information in the main Polyfill README on GitHub. Useful features of PHP 8.0 and their descriptions can be found in this comprehensive document which aids in understanding this particular polyfill component.