schepotin/laravel-api
最新稳定版本:v5.7.0
Composer 安装命令:
composer require schepotin/laravel-api
包简介
Laravel API
关键字:
README 文档
README
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"
}
}
schepotin/laravel-api 适用场景与选型建议
schepotin/laravel-api 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 754 次下载、GitHub Stars 达 6, 最近一次更新时间为 2017 年 07 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「boilerplate」 「laravel」 「vue」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 schepotin/laravel-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 schepotin/laravel-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 schepotin/laravel-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP class to extend when building a WordPress plugin allowing you to follow smart plugin setup standards.
Anax htmlform module.
A PSR-7 compatible library for making CRUD API endpoints
Laravel 5.7 Boilerplate based on Bootstrap 4 and Tabler for Backend.
WordPress Plugin Framework
A Laravel 6 API Boilerplate to create a ready-to-use REST API. User Authentication using JWT.
统计信息
- 总下载量: 754
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-29