neoson/laravel-api-min-boilerplate

简单的Laravel API脚手架

1.0 2018-11-08 01:14 UTC

This package is auto-updated.

Last update: 2024-09-29 05:21:25 UTC


README

这是一个简单的Laravel 5.7 API脚手架,包含非常基本的函数以开始使用。

特性

  • API令牌生成器(邮件验证,密码恢复)
  • clockwork调试
  • Laravel审计
  • 错误日志记录到数据库
  • JWT身份验证
  • Laravel IDE辅助

安装

从终端运行以下命令

composer create-project --prefer-dist neoson/laravel-api-min-boilerplate myProject

运行迁移

php artisan migrate

生成JWT密钥

php artisan jwt:generate

.env.example重命名为.env并设置你的配置

运行应用

php artisan serve

用法

重要目录

API路由: route/api.php
控制器: app/Http/Controllers/V1
模型: app/Model

这个脚手架提供了发送邮件的功能

//run this queue worker
php artisan queue:work

//email template directories
resources/views/emails

API

POST api/auth/register        //register an account and send verification email
POST api/auth/login           //perform login and get jwt token
GET  api/auth/email/verify    //verify email for new account
POST api/auth/recovery        //send a recovery email
GET  api/auth/reset           //reset password after verify recovery email
POST api/auth/refresh         //refresh the jwt token

//the following api require jwt token
//you can include in header(Authorization: Bearer 'token') 
//or as request parameters(token)
POST api/auth/password/change //for changing password
POST api/auth/logout          //logout
POST api/auth/me              //get current authencated user

构建于

许可证

本项目采用MIT许可证 - LICENSE

反馈

欢迎您的反馈和贡献,希望您喜欢它。