nice / security
Simple security component for Nice applications
Installs: 3 222
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
- ircmaxell/password-compat: ~1.0
- symfony/config: ~2.3
- symfony/dependency-injection: ~2.3
- symfony/http-kernel: ~2.3
Requires (Dev)
- nice/framework: 1.0.x-dev
- phpunit/phpunit: ~3.7
This package is auto-updated.
Last update: 2024-10-25 05:38:40 UTC
README
Simple security component for Nice applications.
View the full documentation online.
Installation
Install the nice/security package using Composer.
From your project root directory, run:
composer require nice/security:1.0.x-dev
This command will add nice/security package to your composer.json
and then install the necessary files.
Usage
nice/security includes a default authenticator, Nice\Security\Authenticator\SimpleAuthenticator
. This
authenticator uses the PHP 5.5 password_* API, falling back to ircmaxell's
password_compat library on PHP 5.4.
You must hash your password prior to using nice/security. This can be done through the included hashpass.php
utility.
Full source code to hashpass.php
:
<?php (@include_once __DIR__ . '/../vendor/autoload.php') || @include_once __DIR__ . '/../../../autoload.php'; $in = fopen('php://stdin', 'r'); echo "Enter password to hash: "; $pass = fgets($in); // trim newline $pass = substr($pass, 0, strlen($pass) - 1); $hash = password_hash($pass, PASSWORD_DEFAULT); echo "Hashed result:\n"; echo $hash."\n\n";
This utility is automatically installed in your vendor/bin
directory by Composer.
Run it:
vendor/bin/hashpass