Skip to content

Commit

Permalink
Version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvermeyen committed Mar 28, 2015
0 parents commit 4db9dbe
Show file tree
Hide file tree
Showing 15 changed files with 1,769 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.scrutinizer.yml export-ignore
/phpspec.yml export-ignore
/phpspec-ci.yml export-ignore
/phpunit.xml export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/spec export-ignore
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/vendor
/.cache
/coverage
coverage.*
composer.phar
.idea
.DS_Store
Thumbs.db
24 changes: 24 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
filter:
excluded_paths:
- 'tests/*'
- 'spec/*'

checks:
php:
code_rating: true
duplication: true

coding_style:
php:
spaces:
around_operators:
negation: true

build:
tests:
override:
-
command: 'vendor/bin/phpspec run -f progress -c phpspec-ci.yml'
coverage:
file: 'coverage.clover'
format: 'php-clover'
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- hhvm

before_script:
- composer self-update
- composer install --prefer-source --no-interaction --dev

script: vendor/bin/phpspec run
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

All Notable changes to `Encrypter` will be documented in this file.

## 1.0.0 (2015-03-28)

- Version 1.0.0 of `Encrypter`
- Includes an adapter for Laravel's `Encrypter`
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) 2015 Ivan Vermeyen (<[email protected]>)

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Encrypter

[![GitHub release](https://img.shields.io/github/release/codezero-be/encrypter.svg)]()
[![License](https://img.shields.io/packagist/l/codezero/encrypter.svg)]()
[![Build Status](https://img.shields.io/travis/codezero-be/encrypter.svg?branch=master)](https://travis-ci.org/codezero-be/encrypter)
[![Scrutinizer](https://img.shields.io/scrutinizer/g/codezero-be/encrypter.svg)](https://scrutinizer-ci.com/g/codezero-be/encrypter)
[![Total Downloads](https://img.shields.io/packagist/dt/codezero/encrypter.svg)](https://packagist.org/packages/codezero/encrypter)

#### Encrypt and decrypt strings in PHP.

This package includes an adapter for [Laravel](http://laravel.com/)'s `Encrypter` that adheres to my `Encrypter` interface. This can be used in vanilla PHP. Other implementations might be added in the future.

## Installation

Install this package through Composer:

composer require codezero/encrypter

## Vanilla PHP Implementation

Autoload the vendor classes:

require_once 'vendor/autoload.php'; // Path may vary

Choose a key. You will need the same key that was used to encrypt a string, to decrypt it.

$key = 'my secret key';

And then use the `DefaultEncrypter` implementation:

$encrypter = new \CodeZero\Encrypter\DefaultEncrypter($key);

## Usage

### Encrypt a string

$encrypted = $encrypter->encrypt('some string');

### Decrypt an encrypted string

try {
$decrypted = $encrypter->decrypt($encrypted);
} catch (\CodeZero\Encrypter\DecryptException $exception) {
// Decryption failed...
}
## Testing

$ vendor/bin/phpspec run

## Security

If you discover any security related issues, please [e-mail me](mailto:[email protected]) instead of using the issue tracker.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

---
[![Analytics](https://ga-beacon.appspot.com/UA-58876018-1/codezero-be/encrypter)](https://github.com/igrigorik/ga-beacon)
32 changes: 32 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "codezero/encrypter",
"description": "Encrypt and decrypt strings in PHP.",
"keywords": [
"encryption",
"encrypt",
"php",
"laravel"
],
"license": "MIT",
"authors": [
{
"name": "Ivan Vermeyen",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.4.0",
"illuminate/contracts": "~5.0",
"illuminate/encryption": "~5.0"
},
"require-dev": {
"phpspec/phpspec": "~2.0",
"henrikbjorn/phpspec-code-coverage": "~1.0"
},
"autoload": {
"psr-4": {
"CodeZero\\Encrypter\\": "src/"
}
},
"minimum-stability": "stable"
}
Loading

0 comments on commit 4db9dbe

Please sign in to comment.