Skip to content

Commit

Permalink
init bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
zta9taw committed Jan 10, 2025
1 parent cb538ec commit 22b3c47
Show file tree
Hide file tree
Showing 21 changed files with 4,345 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build.yaml
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
12 changes: 12 additions & 0 deletions .gitignore
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 ###
13 changes: 13 additions & 0 deletions .php-cs-fixer.dist.php
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)
;
45 changes: 45 additions & 0 deletions README.md
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);
}
}
```
42 changes: 42 additions & 0 deletions composer.json
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"
}
}
Loading

0 comments on commit 22b3c47

Please sign in to comment.