Download the PHP package rohsyl/laravel-otc without Composer

On this page you can find all versions of the php package rohsyl/laravel-otc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-otc

Laravel One Time Code Authentication

Latest Version on Packagist CI Quality Score Total Downloads

Laravel One Time Code Authentication allow you to send by mail an one time code to auth your users.

Installation

You can install the package via composer:

Run the installer

Configuration

Edit config/otc.php

notifier_class

Define what class will be called to send the notification. By default it use the Notification facade of Laravel.

notification_class

Define what notification will be sent.

You can replace this class by any other notification, you will recieve a OtcToken $token as constructor parameters

You can access the code that need to be sent from the $token variable

authenticatables

This array will define a list of entites that can be used to get authentified. It's like a simplified version of laravel guard. I might move this to guard in the futur. The main goal is to set what model and what column are used to find the model in the database.

Usage

Check

Check if the user is authenticated

This method will return true or false.

If the user is not authentified you can return an error

This response will return 401 http error with the following body.

You must use the request_code_url as the url to request a code (ye seem obvious) and you must pass the request_code_body as the body in json format !

Request a code

Send a post request

with body

You need to send the type and the identifier of your authenticatables entity

An email will be sent to the corresponding entity if available. The email will contain the code.

Request a token

Send a post request

with body

You need to send the code that should have been retrieved from the user through a form or anything else.

You will recieve a token back

And you can use this token for every further request.

Authentified request

When you have the token, you can send it with you request to be authentified.

Pass it in the headers

Or in the query string

Troubleshooting

CORS

If you use fruitcake/laravel-cors to manage CORS in your app. You will get CORS error when doing call to this package endpoints.

You will need to add a new path in your config/cors.php in the paths array

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please use the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-otc with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0.2
spatie/laravel-package-tools Version ^1.13.0
illuminate/contracts Version ^9.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rohsyl/laravel-otc contains the following files

Loading the files please wait ....