diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 282131b..69d4755 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -22,7 +22,7 @@ checks: tools: external_code_coverage: timeout: 600 - runs: 3 + runs: 4 php_code_sniffer: enabled: true config: diff --git a/.travis.yml b/.travis.yml index d3d390c..311b6ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,10 @@ language: php -sudo: false - php: - 7.1.3 - 7.1 - 7.2 + - 7.3 - nightly matrix: diff --git a/README.md b/README.md index db33a2b..8d109ec 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/_docs/0-Home.md b/_docs/0-Home.md index 406aa00..c1dfdf8 100644 --- a/_docs/0-Home.md +++ b/_docs/0-Home.md @@ -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 diff --git a/_docs/1-Installation-and-Setup.md b/_docs/1-Installation-and-Setup.md index 46a4e82..920127d 100644 --- a/_docs/1-Installation-and-Setup.md +++ b/_docs/1-Installation-and-Setup.md @@ -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" @@ -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 @@ -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: diff --git a/_docs/3-Usage.md b/_docs/3-Usage.md index c79cdcc..646d7d1 100644 --- a/_docs/3-Usage.md +++ b/_docs/3-Usage.md @@ -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. @@ -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: diff --git a/composer.json b/composer.json index 187f741..e59fcdc 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/helpers.php b/helpers.php index 71bd863..7902bf4 100644 --- a/helpers.php +++ b/helpers.php @@ -1,28 +1,14 @@ with($option, $driver); + function hasher() { + return app(HashManager::class); } } diff --git a/src/Facades/Hasher.php b/src/Facades/Hasher.php deleted file mode 100644 index 5090e9e..0000000 --- a/src/Facades/Hasher.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ -class Hasher extends Facade -{ - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() { return HashManager::class; } -} diff --git a/tests/Drivers/HashidsDriverTest.php b/tests/Drivers/HashidsDriverTest.php index bd68cbe..4163988 100644 --- a/tests/Drivers/HashidsDriverTest.php +++ b/tests/Drivers/HashidsDriverTest.php @@ -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); diff --git a/tests/HasherManagerTest.php b/tests/HasherManagerTest.php index 486ad3a..f6510ce 100644 --- a/tests/HasherManagerTest.php +++ b/tests/HasherManagerTest.php @@ -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); @@ -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); diff --git a/tests/HasherServiceProviderTest.php b/tests/HasherServiceProviderTest.php index 17670c9..b1ce88b 100644 --- a/tests/HasherServiceProviderTest.php +++ b/tests/HasherServiceProviderTest.php @@ -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); diff --git a/tests/TestCase.php b/tests/TestCase.php index 235cab5..46c9c9c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -15,7 +15,7 @@ abstract class TestCase extends BaseTestCase | ----------------------------------------------------------------- */ - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -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. *