定制 schepotin/laravel-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

schepotin/laravel-api

最新稳定版本:v5.7.0

Composer 安装命令:

composer require schepotin/laravel-api

包简介

Laravel API

README 文档

README

Build Status

Laravel API

Install

Install package:

composer require schepotin/laravel-api

Run command:

php artisan laravel-api:publish --api

Run migrations:

php artisan migrate

Boilerplate for Vue

php artisan laravel-api:publish --vue
npm install
npm run dev

Eslint

npm run eslint

API

Register:

request:

fetch('/api/v1/register', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
  },
  body: "name=John&email=johndoe@gmail.com&password=qwerty&password_confirmation=qwerty",
})
.then((response) => response.json())
.then((data) => {
  console.log(data);
});

response:

{
  "status": 1,
  "token": "yQZKTMgpB9wmX3seCH1XKrHyq62YQXijvnoAkFsHXmNcuv5SRhiTuWqbdsIP"
}

Login:

request:

fetch('/api/v1/login', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
  },
  body: "email=johndoe@gmail.com&password=123456",
})
.then((response) => response.json())
.then((data) => {
  console.log(data);
});

response:

{
  "status": 1,
  "token": "yQZKTMgpB9wmX3seCH1XKrHyq62YQXijvnoAkFsHXmNcuv5SRhiTuWqbdsIP"
}

Password reset:

request:

fetch('/api/v1/password/email', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
  },
  body: "email=johndoe@gmail.com",
})
.then((response) => response.json())
.then((data) => {
  console.log(data);
});

response:

{
  "status": 1,
  "data": {
    "message": "passwords.sent"
  }
}

request:

fetch('/api/v1/reset/password', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
  },
  body: "email=johndoe@gmail.com&password=qwerty&password_confirmation=qwerty&token=2b8db1c9655ed1dcf1752867b652774e48e890e2709daa992f271df5d787a8ce",
})
.then((response) => response.json())
.then((data) => {
  console.log(data);
});

response:

{
  "status": 1,
  "data": {
    "message": "passwords.reset"
  }
}

Get current logged user

request:

fetch('/api/v1/user/current', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
    Authorization: 'Bearer yQZKTMgpB9wmX3seCH1XKrHyq62YQXijvnoAkFsHXmNcuv5SRhiTuWqbdsIP',
  },
})
.then((response) => response.json())
.then((data) => {
  console.log(data);
});

response:

{
  "status": 1,
  "data": {
    "id": 1,
    "name": "John",
    "email": "johndoe@gmail.com",
    "created_at": "2017-09-23 12:26:44",
    "updated_at": "2017-09-23 12:26:44"
  }
}

统计信息

  • 总下载量: 754
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 5
  • Forks: 3
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固