Skip to content

Commit c188a9f

Browse files
committed
Initial commit
0 parents  commit c188a9f

File tree

11 files changed

+2310
-0
lines changed

11 files changed

+2310
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor

LICENCE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Claude Fassinou
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# PHP Crypter
2+
Secure the data of your websites by encrypting them. They will be decrypted only in your applications with your secret key
3+
4+
# How to install ?
5+
6+
## With composer
7+
8+
* Firstly you need composer
9+
* Run the command `composer require claudye/php-crypter`
10+
11+
## Clone or download from github
12+
* Clone or download from [github](https://github.com/Claudye/php-crypter)
13+
* Be sure you have [composer](https://getcomposer.org/) installed
14+
* Goto the root of your project and open there a shell (terminal)
15+
* Run `composer install`
16+
17+
# Usage
18+
When php crypter is successful installed, please import the Encryption class like :
19+
20+
`use PHPCrypter\Encryption\Encryption;`
21+
22+
* To encrypt a data, you use `Encryption::encrypt(string $text, string $algo_method="AES-128-CBC", string $token=null)`
23+
This method requires the data to be encrypted, other arguments are optional. It returns encrypted data that you can store or write somewhere for reuse
24+
* To decrypt the encrypted information later you can use the method
25+
`Encryption::decrypt(string $data_encrypted)`
26+
This method will use the generated key for you to decrypt the data which was encrypted. This key must be secret
27+
28+
# Example
29+
<pre>
30+
<code>
31+
32+
use PHPCrypter\Encryption\Encryption;
33+
//You can define your key any where you want
34+
35+
//define("ENC_TOKEN_PATH", "your/dir/example");
36+
37+
require 'vendor/autoload.php';
38+
// Encrypt the text "The only limit of a developer is his imagination" <br> <br>
39+
$encrypt = Encryption::encrypt("The only limit of a developer is his imagination");
40+
41+
//You store the encrypted data in a file or in a database, or any where you can reuse it <br>
42+
//After you want to use it again on your site <br>
43+
//Get your text: $encrypt and then decrypt it <br>
44+
$decrypt = Encryption::decrypt($encrypt);
45+
46+
//All right ! <br>
47+
48+
</code>
49+
</pre>
50+
51+
# Change encryption key path!
52+
53+
It is possible to change the encryption key path (file or directory) where you want to store the secret key! It's a good idea to choose a very secure path
54+
55+
# Information
56+
The encryption method used by default is : AES-128-CBC
57+
[Find all the methods here](https://www.php.net/manual/fr/function.openssl-get-cipher-methods.php)
58+
59+
### Attention!
60+
**When your data is encrypted with a key, only this key can decrypt it, so be careful not to lose your keys or change your keys carelessly.**

composer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "claudye/php-crypter",
3+
"description": "Secure the data of your websites by encrypting them. They will be decrypted only in your applications with your secret key",
4+
"type": "library",
5+
"homepage": "https://github.com/Claudye/php-crypter",
6+
"require": {
7+
"php": ">=7.3 || 8.2"
8+
},
9+
"require-dev": {
10+
"phpunit/phpunit": "^9"
11+
},
12+
"license": "MIT",
13+
"autoload": {
14+
"psr-4": {
15+
"PHPCrypter\\": "src/"
16+
}
17+
},
18+
"authors": [
19+
{
20+
"name": "Claudye",
21+
"email": "dev.claudy@gmail.com"
22+
}
23+
]
24+
}

0 commit comments

Comments
 (0)