GithubHelp home page GithubHelp logo

fideloper / cli-browser-register Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 135 KB

Example of using a CLI command to kick off registration and magically get an API key back

PHP 61.19% JavaScript 0.60% CSS 0.03% Blade 38.18%

cli-browser-register's Introduction

CLI to Browser

See how to make the CLI communicate with the browser (your app).

In this case, we'll create a user in your app via the CLI by sending them to the browser. When the user registers, a valid API token is retrieved back by the CLI, allowing it to make future API calls against the applications (fictional) API.

Files to Care About

  1. app/Console/Commands/RegisterCommand.php - the command that lets users register. In reality this would likely be a separate project (a cli app that users install locally, which can communicate to your app's API)
  2. routes/api.php - Defines a Resource controller App\Http\Controllers\CliSessionController
  3. app/Http/Controllers/CliSessionController.php - the controller allow CLI users to create/check on a CLI session
  4. app/Http/Controllers/Auth/RegisteredUserController.php - Laravel Breeze register controller, which tweaks for CLI session registration
    • resources/views/auth/register.blade.php - companion tweaks for Breeze's registration
  5. app/Models/CliSession.php - the CLISession model, which is simple
    • database/migrations - a migration to create the cli_sessions table

cli-browser-register's People

Contributors

fideloper avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.