Overview

Namespaces

  • Deimos
    • Secure
      • Extension

Classes

  • Deimos\Secure\Secure

Traits

  • Deimos\Secure\Extension\Algorithm
  • Deimos\Secure\Extension\IV
  • Deimos\Secure\Extension\Secret
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: namespace Deimos\Secure;
 4: 
 5: use Deimos\Secure\Extension\Algorithm;
 6: use Deimos\Secure\Extension\IV;
 7: use Deimos\Secure\Extension\Secret;
 8: 
 9: class Secure
10: {
11: 
12:     use IV;
13:     use Secret;
14:     use Algorithm;
15: 
16:     /**
17:      * @param $value
18:      *
19:      * @return $this
20:      */
21:     public function algorithm($value)
22:     {
23:         return $this->setAlgorithm($value);
24:     }
25: 
26:     /**
27:      * @param $value
28:      *
29:      * @return $this
30:      */
31:     public function secret($value)
32:     {
33:         return $this->setSecret($value);
34:     }
35: 
36:     /**
37:      * @param $value
38:      *
39:      * @return $this
40:      */
41:     public function iv($value)
42:     {
43:         return $this->setIV($value);
44:     }
45: 
46:     /**
47:      * @param string $data
48:      *
49:      * @return string
50:      */
51:     public function encrypt($data)
52:     {
53:         return openssl_encrypt($data, $this->algorithm, $this->secret, 0, $this->iv);
54:     }
55: 
56:     /**
57:      * @param string $data
58:      *
59:      * @return string
60:      */
61:     public function decrypt($data)
62:     {
63:         return openssl_decrypt($data, $this->algorithm, $this->secret, 0, $this->iv);
64:     }
65: 
66: }
API documentation generated by ApiGen