Skip to content

Instantly share code, notes, and snippets.

@rugk
Last active January 14, 2016 17:08
Show Gist options
  • Save rugk/eae69ad07042a1d51d57 to your computer and use it in GitHub Desktop.
Save rugk/eae69ad07042a1d51d57 to your computer and use it in GitHub Desktop.
Libsodium version debug PHP
<?php
// check load state
if (extension_loaded('libsodium')) {
echo 'libsodium is loaded<br/>';
} else {
echo 'libsodium is not loaded<br/>';
exit;
}
// check version
if (method_exists('Sodium', 'sodium_version_string')) {
echo 'you use an old version of libsodium (<0.2.0)<br/>';
echo 'Sodium version: ' . Sodium::sodium_version_string();
} else {
echo 'you use a recent version of libsodium<br/>';
echo 'Sodium version: ' . \Sodium\version_string();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment