Package Data | |
---|---|
Maintainer Username: | cviebrock |
Maintainer Contact: | colin@viebrock.ca (Colin Viebrock) |
Package Create Date: | 2014-04-25 |
Package Last Update: | 2014-04-25 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-17 03:01:27 |
Package Statistics | |
---|---|
Total Downloads: | 83 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 9 |
Total Watchers: | 3 |
Total Forks: | 2 |
Total Open Issues: | 0 |
Adds Artisan tasks to Laravel to work with password hashes from the CLI.
First, add the package to the require-dev
attribute of your composer.json
file:
{
"require": {
"cviebrock/artisan-hash": "1.*"
},
}
You could add it to the
require
section instead, but you likely only need this during development.
Next, update Composer from the Terminal:
composer update --dev
Once this operation completes, add the service provider. Open app/config/app.php
, and add a new item to the providers array.
'Cviebrock\ArtisanHash\ArtisanHashServiceProvider'
That's it! Run the artisan
command from the Terminal to see the new commands.
php artisan
This will hash the given plaintext string and output the hash to the console. If you don't provide a string, you will be asked to enter one (this will keep the plaintext string out of your shell history).
$ php artisan hash:make foo
$2y$08$3nq5mD1faNAPUdyt72yyqOTRl/OIrizhQ84EnH1kbouC/8ud31smW
This will compare a given hash to a plaintext string and see if they match.
$ php artisan hash:check '$2y$08$3nq5mD1faNAPUdyt72yyqOTRl/OIrizhQ84EnH1kbouC/8ud31smW' foo
Hash matches.
Note that if the hash contains dollar signs -- as it likely will -- you will need to escape them in your shell. The easiest way is just to surround the hash in single quotes, or don't provide the hash via the command and use the prompt.
The command will also check if the hash needs rehashing.
$ php artisan hash:check '$1$stCkrNrE$W92vGH25VHnLK.kDBmZwz0' foo
Hash matches.
Your hash needs to be rehashed.
Please use Github for bugs, comments, suggestions.
composer install --dev
in the root directory to install required testing packages.artisan-hash/tests/
.vendor/bin/phpunit
to the new (and all previous) tests and make sure everything passes.develop
branch.Please note that you must create your pull request against the develop
branch.
artisan-hash was written by Colin Viebrock and released under the MIT License. See the LICENSE file for details.
Copyright 2014 Colin Viebrock