DZ Framework
, (*1)
DZ Framework is an ultra little PHP classes package provided by DZ Estúdio. Its features are a hash generator and a geographic conversions class., (*2)
Components
Dz\Security\Hash
Hash generator class., (*3)
``` php
<?php, (*4)
use \Dz\Security\Hash;, (*5)
// Let's say that user has filled these two variables.
$email = 'example@example.com';
$password = 'mYs3cR3tP4S5W0Rd!';, (*6)
// Think about some reproducible salt schema...
$saltBase = md5('Kynodontas#' . $email);, (*7)
// Now, let's hash!
$hash = new Hash(array('saltBase' => $saltBase));, (*8)
// Save hash somewhere.
$passwordHash = $hash->crypt($password);, (*9)
// Now, let's check. One more time, pretend that there's an user here!
$emailInput = 'example@example.com';
$passwordInput = 'wR0NgP4S5W0Rd!';, (*10)
// Here is our reproducible salt schema.
$saltBase = md5('Kynodontas#' . $emailInput);
$hash = new Hash(array('saltBase' => $saltBase));, (*11)
if ($hash->check($passwordHash, $passwordInput)) {
// Hashes match :-)
} else {
// Something wrong...
}, (*12)
### Dz\Maps\Converter
This class uses Google Maps API to convert addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you can use to place markers or position a map.
An example:
``` php
<?php
$address = 'Rua Vinte e Quatro de Outubro, 353';
$latLng = \Dz\Maps\Converter::fromAddressToLatLng($address);
echo 'Latitude: ', $latLng->lat, PHP_EOL;
echo 'Longitude: ', $latLng->lng, PHP_EOL;
You can use it to convert DMSs to decimals too:, (*13)
``` php
<?php, (*14)
// Cachoeira do Sul DMS latitude
$dmsLat = "30° 2' 54.0276'' S";
$decimalLat = \Dz\Maps\Converter::fromDmsToDecimal($dmsLat);, (*15)
echo 'Latitude: ', $decimalLat, PHP_EOL;
```, (*16)