PHP code example of atrapalo / urlcrypt

1. Go to this page and download the library: Download atrapalo/urlcrypt library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

atrapalo / urlcrypt example snippets


use Atrapalo\UrlCrypt;

$urlCrypt = new UrlCrypt(); // Or $urlCrypt = UrlCrypt::getInstance()

// encoding without encryption. (don't use for anything sensitive)
$encoded = $urlCrypt->encode('Atrapalo');	// --> "3f5h2ylqmfwg9"
$decoded = $urlCrypt->decode('3f5h2ylqmfwg9');	// --> "Atrapalo"

// encrypting and encoding
$key = 'bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3';
$encrypted = $urlCrypt->encrypt('Atrapalo', $key);
		// --> 'xApfAdvAxg55jvk75y5n2d26xrhv3qtgfmxAmq53mf1t5'
$decrypted = $urlCrypt->decrypt('xApfAdvAxg55jvk75y5n2d26xrhv3qtgfmxAmq53mf1t5', $key)
		// --> 'Atrapalo'