symfony/polyfill-php55
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The Symfony Polyfill PHP55 is a robust tool designed to backport some PHP 5.5+ features to lower PHP versions. It essentially provides functions that are unavailable in releases prior to PHP 5.5. A few notable functions include boolval
, json_last_error_msg
, array_column
, hash_pbkdf2
, and password_*
functions. By utilizing Symfony Polyfill PHP55, developers can leverage advanced PHP 5.5+ features on lower PHP versions, thus ensuring their web applications remain compatible and functional, even with older PHP environments.
Usage of the Symfony Polyfill PHP55 is fairly simple and straightforward. Once you have installed the package via Composer, you can use the Polyfill functions as you would any other PHP function. Here are a few examples:
// Using boolval function
$testVar = 'some value';
$boolean = boolval($testVar);
// Using json_last_error_msg function
$json = 'invalid json string';
$jsonDecode = json_decode($json);
if (json_last_error()) {
echo json_last_error_msg();
}
// Using array_column function
$records = array(
array(
'id' => 2135,
'first_name' => 'John',
'last_name' => 'Doe',
),
array(
'id' => 3245,
'first_name' => 'Sally',
'last_name' => 'Smith',
)
);
$firstNames = array_column($records, 'first_name');
The Symfony Polyfill PHP55 documentation can be found on the main Polyfill README on Symfony's GitHub repository. It provides a comprehensive guide on how the Polyfill works and how to use the various backported functions. For more specific details and usage guides for individual functions, you can visit their respective official PHP documentation links provided in the README. Visit the main Polyfill README on GitHub for more information.