-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
4,316 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
- main | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
- develop | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
php-versions: ['8.0', '8.1', '8.2', '8.3'] | ||
name: Continues Integration (PHP ${{ matrix.php-versions }}) | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout project | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
# Install php & composer | ||
- name: Setup PHP, extensions and composer with shivammathur/setup-php | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, xml, ctype, iconv, intl, dom, filter, iconv, json | ||
env: | ||
update: true | ||
- name: Check PHP Version | ||
run: php -v | ||
# Composer | ||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache composer dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
- name: Install Composer dependencies | ||
run: composer install | ||
# Coding standard | ||
- name: Coding standards checks | ||
run: ./bin/php-cs-fixer fix --diff --dry-run | ||
# PhpUnit | ||
- name: PhpUnit | ||
run: bin/simple-phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/bin/* | ||
/vendor/ | ||
/.idea/ | ||
/.phpunit.result.cache | ||
/Dockerfile | ||
/docker-compose.yaml | ||
/Makefile | ||
|
||
###> friendsofphp/php-cs-fixer ### | ||
/.php-cs-fixer.php | ||
/.php-cs-fixer.cache | ||
###< friendsofphp/php-cs-fixer ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
$finder = (new PhpCsFixer\Finder()) | ||
->in(__DIR__) | ||
->exclude('vendor') | ||
; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRules([ | ||
'@Symfony' => true, | ||
]) | ||
->setFinder($finder) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Encryption | ||
|
||
> The encryption bundle is a symfony bundle that allow you to encrypt and decrypt sensitive data based on a given encryption key, sipher algorithm and digest method. | ||
#### Usage | ||
|
||
1- Configuration | ||
|
||
``` | ||
# /config/packages/encryption.yaml | ||
encryption: | ||
password: | ||
encryption_key: hO!}098iKko_hf | ||
email: | ||
encryption_key: '%my_key_parameter%' | ||
cypher_algorithm: aes128 | ||
digest_method: md5 | ||
``` | ||
|
||
> With this configuration, you will have access to a private service (instance of `Wemxo\EncryptionBundle\Encryption\EncryptionInterface`) in container named `@wemxo.encryption.password` with an alias `$passwordEncryption`. | ||
2- Example | ||
|
||
``` | ||
<?php | ||
namespace App; | ||
classe MyService { | ||
public function __construct(private EncryptionInterface $passwordEncryption, private EncryptionInterface $emailEncryption) | ||
{ | ||
} | ||
public function testEncryptPassword(string $text): string | ||
{ | ||
return $this->passwordEncryption->encrypt($text); | ||
} | ||
public function testDecryptPassword(string $text): string | ||
{ | ||
return $this->passwordEncryption->decrypt($text); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "wemxo/encryption-bundle", | ||
"description": "Useful symfony bundle that offers the possibility to encrypt/decrypt sensitive data.", | ||
"minimum-stability": "stable", | ||
"license": "MIT", | ||
"type": "symfony-bundle", | ||
"prefer-stable": true, | ||
"keywords": [ | ||
"wemxo", | ||
"encryption", | ||
"bundle" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Abdelhak OUADDI [zta9taw]", | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/zta9taw" | ||
} | ||
], | ||
"require": { | ||
"php": ">=8.0.2", | ||
"ext-openssl": "*", | ||
"symfony/framework-bundle": "^6.0|^7.0" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^3.65", | ||
"symfony/phpunit-bridge": "^6.0|^7.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Wemxo\\EncryptionBundle\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Wemxo\\EncryptionBundle\\Tests\\": "tests/" | ||
} | ||
}, | ||
"config": { | ||
"bin-dir": "bin" | ||
} | ||
} |
Oops, something went wrong.