Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addin laravel 5.8 support #14

Merged
merged 1 commit into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 3
runs: 4
php_code_sniffer:
enabled: true
config:
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
language: php

sudo: false

php:
- 7.1.3
- 7.1
- 7.2
- 7.3
- nightly

matrix:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/Hasher/releas
* Flexible hash manager.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Laravel `5.0` to `5.7` are supported.
* Laravel `5.0` to `5.8` are supported.
* Made with :heart: & :coffee:.

## Table of contents
Expand All @@ -49,7 +49,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.
- [All Contributors][link-contributors]

[badge_license]: https://img.shields.io/packagist/l/arcanedev/hasher.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/For%20Laravel-5.0%20to%205.7-orange.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/For%20Laravel-5.0%20to%205.8-orange.svg?style=flat-square

[badge_build]: https://img.shields.io/travis/ARCANEDEV/Hasher.svg?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/Hasher.svg?style=flat-square
Expand Down
2 changes: 1 addition & 1 deletion _docs/0-Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Hasher package provides a flexible hash manager for Laravel.
* Flexible hash manager.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Laravel `5.0` to `5.7` are supported.
* Laravel `5.0` to `5.8` are supported.
* Made with :heart: & :coffee:.

## Table of contents
Expand Down
14 changes: 3 additions & 11 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| ![Hasher v2.2.x][hasher_2_2_x] | ![Laravel v5.5][laravel_5_5] |
| ![Hasher v2.3.x][hasher_2_3_x] | ![Laravel v5.6][laravel_5_6] |
| ![Hasher v2.4.x][hasher_2_4_x] | ![Laravel v5.7][laravel_5_7] |
| ![Hasher v2.5.x][hasher_2_5_x] | ![Laravel v5.8][laravel_5_8] |

[laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0"
[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
Expand All @@ -24,12 +25,14 @@
[laravel_5_5]: https://img.shields.io/badge/v5.5-supported-brightgreen.svg?style=flat-square "Laravel v5.5"
[laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6"
[laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7"
[laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8"

[hasher_2_0_x]: https://img.shields.io/badge/version-2.0.*-blue.svg?style=flat-square "Hasher v2.0.*"
[hasher_2_1_x]: https://img.shields.io/badge/version-2.1.*-blue.svg?style=flat-square "Hasher v2.1.*"
[hasher_2_2_x]: https://img.shields.io/badge/version-2.2.*-blue.svg?style=flat-square "Hasher v2.2.*"
[hasher_2_3_x]: https://img.shields.io/badge/version-2.3.*-blue.svg?style=flat-square "Hasher v2.3.*"
[hasher_2_4_x]: https://img.shields.io/badge/version-2.4.*-blue.svg?style=flat-square "Hasher v2.4.*"
[hasher_2_5_x]: https://img.shields.io/badge/version-2.5.*-blue.svg?style=flat-square "Hasher v2.5.*"

## Composer

Expand All @@ -52,17 +55,6 @@ Once the package is installed, you can register the service provider in `config/
],
```

(**Optional**) And for the Facades:

```php
// config/app.php

'aliases' => [
...
'Hasher' => Arcanedev\Hasher\Facades\Hasher::class,
];
```

### Artisan commands

To publish the config file, run this command:
Expand Down
10 changes: 1 addition & 9 deletions _docs/3-Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,13 @@ $hasher = hasher()->with('alt');
You can also use another helper if you don't like calling multiple methods:

```php
$hasher = hash_with('alt');
$hasher = hasher()->with('alt');
```

Of course, you can specify the `option` and the `driver` at the same time with the same helpers:

```php
$hasher = hasher()->with('alt', 'custom-driver');

// OR

$hasher = hash_with('alt', 'custom-driver');
```

> Note: if you don't specify the driver name, it will grab the default driver.
Expand All @@ -104,10 +100,6 @@ $option = hasher()->getDefaultOption()
$manager = hasher()->option('alt');
```

## Facade

> You start with `Hasher::` Facade and you call the same methods as mentioned above. **(Don't repeat yourself rule).**

## IOC

The Hash Manager is binded to `Arcanedev\Hasher\Contracts\HashManager` Contract, you can get the instance by doing this:
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"license": "MIT",
"require": {
"php": ">=7.1.3",
"arcanedev/support": "~4.4.0",
"arcanedev/support": "~4.5.0",
"hashids/hashids": "~3.0|~4.0"
},
"require-dev": {
"orchestra/testbench": "~3.7.0",
"phpunit/phpunit": "~7.0",
"phpunit/phpcov": "~5.0"
"orchestra/testbench": "~3.8.0",
"phpunit/phpunit": "~7.0|~8.0",
"phpunit/phpcov": "~5.0|~6.0"
},
"autoload": {
"psr-4": {
Expand Down
22 changes: 4 additions & 18 deletions helpers.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
<?php

use Arcanedev\Hasher\Contracts\HashManager;

if ( ! function_exists('hasher')) {
/**
* Get the Hash Manager instance.
*
* @return \Arcanedev\Hasher\Contracts\HashManager
*/
function hasher()
{
return app(Arcanedev\Hasher\Contracts\HashManager::class);
}
}

if ( ! function_exists('hash_with')) {
/**
* Get the Hash Driver instance.
*
* @param string $option
* @param string|null $driver
*
* @return \Arcanedev\Hasher\Contracts\HashDriver
*/
function hash_with($option, $driver = null)
{
return hasher()->with($option, $driver);
function hasher() {
return app(HashManager::class);
}
}
20 changes: 0 additions & 20 deletions src/Facades/Hasher.php

This file was deleted.

6 changes: 3 additions & 3 deletions tests/Drivers/HashidsDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ class HashidsDriverTest extends TestCase
| -----------------------------------------------------------------
*/

protected function setUp()
protected function setUp(): void
{
parent::setUp();

$this->hasher = new HashidsDriver([
'salt' => 'This is my main salt',
'salt' => "We don't have salt. Is pepper OK ?",
'length' => 8,
'alphabet' => 'abcdefghij1234567890',
]);
}

protected function tearDown()
protected function tearDown(): void
{
unset($this->hasher);

Expand Down
8 changes: 4 additions & 4 deletions tests/HasherManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class HasherManagerTest extends TestCase
| -----------------------------------------------------------------
*/

protected function setUp()
protected function setUp(): void
{
parent::setUp();

$this->manager = $this->app->make(\Arcanedev\Hasher\Contracts\HashManager::class);
}

protected function tearDown()
protected function tearDown(): void
{
unset($this->manager);

Expand Down Expand Up @@ -141,8 +141,8 @@ public function it_can_encode_and_decode()
public function it_can_encode_and_decode_with_helper()
{
$value = 123456;
$mainDriver = hash_with('main');
$altDriver = hash_with('alt');
$mainDriver = hasher()->with('main');
$altDriver = hasher()->with('alt');

$mainHashed = $mainDriver->encode($value);
$altHashed = $altDriver->encode($value);
Expand Down
4 changes: 2 additions & 2 deletions tests/HasherServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class HasherServiceProviderTest extends TestCase
| -----------------------------------------------------------------
*/

protected function setUp()
protected function setUp(): void
{
parent::setUp();

$this->provider = $this->app->getProvider(HasherServiceProvider::class);
}

protected function tearDown()
protected function tearDown(): void
{
unset($this->provider);

Expand Down
16 changes: 1 addition & 15 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class TestCase extends BaseTestCase
| -----------------------------------------------------------------
*/

protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand All @@ -36,20 +36,6 @@ protected function getPackageProviders($app)
];
}

/**
* Get package aliases.
*
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageAliases($app)
{
return [
\Arcanedev\Hasher\Facades\Hasher::class,
];
}

/**
* Define environment setup.
*
Expand Down