SUKOHI / Mtriv by Sukohi

A PHP package mainly developed for Laravel to verfy simply.
46
0
2
Package Data
Maintainer Username: Sukohi
Maintainer Contact: capilano.sukohi@gmail.com (Sukohi)
Package Create Date: 2014-10-15
Package Last Update: 2017-01-31
Language: PHP
License: MIT
Last Refreshed: 2024-05-15 15:08:36
Package Statistics
Total Downloads: 46
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Mtriv

A PHP package mainly developed for Laravel to verify simply.
(This is for Laravel 5+. For Laravel 4.2)

Installation

Add this package name in composer.json

"require": {
  "sukohi/mtriv": "2.*"
}

Execute composer command.

composer update

Register the service provider in app.php

'providers' => [
    ...Others...,  
    Sukohi\Mtriv\MtrivServiceProvider::class,
]

Also alias

'aliases' => [
    ...Others...,  
    'Mtriv'   => Sukohi\Mtriv\Facades\Mtriv::class
]

Usage

At first generate public key using secret key, string and expiration(skippable) like the following.

$str = 'STRING, ID and so on...';
$expiration = time(); // Skippable
$public_key = \Mtriv::secretKey('SECRET_KEY')->publicKey($str, $expiration);

and then you can verify.

if(\Mtriv::secretKey('SECRET_KEY')->check($str, $public_key, $expiration)) {
		
    echo 'success!';
		
}

License

This package is licensed under the MIT License.

Copyright 2014 Sukohi Kuhoh