symfony/polyfill-php56
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Symfony/polyfill-php56 is a nifty PHP package that essentially brings the functionality of some functions, introduced in PHP 5.6, to the platforms that run lower versions of PHP. Specifically, it provides support for functions 'hash_equals' and 'ldap_escape' if they aren't available in your PHP version. 'hash_equals' function compares two strings in a time-insensitive manner and 'ldap_escape' function escapes a string for use in an LDAP filter or DN.
Symfony/polyfill-php56 can be conveniently integrated into a PHP project through Composer - a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. To begin using symfony/polyfill-php56
, you can add it to your project by running the following composer command:
composer require symfony/polyfill-php56
Now, you can use the 'hash_equals' and 'ldap_escape' functions in your code like they are built-in functions, no extra code is required.
// using hash_equals function
$hash = crypt('mypassword', '$2a$07$usesomesillystringforsalt$');
$isCorrectPassword = hash_equals($hash, crypt('mypassword', $hash));
// using ldap_escape function
$ldapFilter = ldap_escape('(&(objectCategory=person)(objectClass=user)(name=*))', '', LDAP_ESCAPE_FILTER);
Complete documentation for the symfony/polyfill-php56 can be found in the main Polyfill README on its GitHub repository at https://github.com/symfony/polyfill/blob/master/README.md. Within the README, you find all necessary usage instructions and also learn more about other functionality the Symfony polyfills provide.