popphp/pop-bootstrap 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

popphp/pop-bootstrap

Composer 安装命令:

composer require popphp/pop-bootstrap

包简介

A skeleton application for the Pop Web Application Framework, using Bootstrap Material Icons and Font Awesome frameworks.

README 文档

README

END OF LIFE

The pop-bootstrap component is now end-of-life and will no longer be maintained.

Release Information

Version 4.2.0 February 6, 2019

Overview

This repository is a skeleton web application for the Pop Web Application Framework using the Bootstrap v4, Material Icons and Font Awesome frameworks. The concept behind this skeleton framework focuses on a minimal feature set that allows access view a basic web interface, an API and also the console.

Requirements

  • Minimum of PHP 7.1.0
  • Apache 2+, IIS 7+, or any web server with URL rewrite support
  • MySQL 5.0+

Top

Installation

The command below will install all of the necessary components, seed the database and take you through the installation steps automatically:

$ composer create-project popphp/pop-bootstrap project-folder
$ cd project-folder
$ npm install
$ npm run build

Alternatively, the last command above can be npm run dev if you'd like build the UI assets for a dev environment instead.

Top

Getting Started

You can start the web server by running the kettle command:

$ ./kettle serve

Visit the main web address at http://localhost:8000. You will be redirected to a login screen. The default credentials are:

  • Username: admin
  • Password: password

Top

Web Access

Once logged in via a web browser, you will see that most of the navigation displayed is not active, with the exception of the Orders page, the Users page and the Logout icon. The Orders page demonstrates a mock layout with side navigation. The Users page will let you manage users. The Logout icon executes a user logout.

Top

API Access

You can access the API to authenticate a user or manage users as well. The following examples use cURL to demonstrate the accessing the API:

Authentication

curl -i -X POST -d"username=admin&password=password" \
    http://localhost:8000/api/auth

Upon a successful authentication, you will receive a JSON response that looks like this:

HTTP/1.1 200 OK
Host: localhost:8000
Connection: close
X-Powered-By: PHP/7.1.9
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Allow-Methods: HEAD, OPTIONS, GET, PUT, POST, PATCH, DELETE

{
    "id": 1,
    "username": "admin",
    "token": "449d8625fb26753ebce8acbbf38ba2321dd21621",
    "refresh": "a5bba1af879c64e591307b48e1fdd7f2d85cba5f",
    "expires": 1504754891
}

With that, you'll be able to continue accessing the API.

Top

Validate the Token

curl -i -X POST --header "Authorization: Bearer 449d8625fb26753ebce8acbbf38ba2321dd21621" \
    http://localhost:8000/api/auth/token
HTTP/1.1 200 OK
Host: localhost:8000
Connection: close
X-Powered-By: PHP/7.1.9
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Allow-Methods: HEAD, OPTIONS, GET, PUT, POST, PATCH, DELETE

Top

Refresh the Token

curl -i -X POST --header "Authorization: Bearer 449d8625fb26753ebce8acbbf38ba2321dd21621" \
    -d"refresh=a5bba1af879c64e591307b48e1fdd7f2d85cba5f" http://localhost:8000/api/auth/token/refresh
HTTP/1.1 200 OK
Host: localhost:8000
Connection: close
X-Powered-By: PHP/7.1.9
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Allow-Methods: HEAD, OPTIONS, GET, PUT, POST, PATCH, DELETE

{
    "token": "8012796bbedb79fc4cecedcf174640f1b5796f08",
    "refresh": "a5bba1af879c64e591307b48e1fdd7f2d85cba5f",
    "expires": 1504754891
}

Top

Revoke the Token

curl -i -X POST --header "Authorization: Bearer 8012796bbedb79fc4cecedcf174640f1b5796f08" \
    http://localhost:8000/api/auth/token/revoke
HTTP/1.1 200 OK
Host: localhost:8000
Connection: close
X-Powered-By: PHP/7.1.9
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Allow-Methods: HEAD, OPTIONS, GET, PUT, POST, PATCH, DELETE

Top

Manage Users

Get Users
curl -i -X GET --header "Authorization: Bearer 8012796bbedb79fc4cecedcf174640f1b5796f08" \
    http://localhost:8000/api/users
Get a User
curl -i -X GET --header "Authorization: Bearer 8012796bbedb79fc4cecedcf174640f1b5796f08" \
    http://localhost:8000/api/users/1
Create User
curl -i -X POST --header "Authorization: Bearer 8012796bbedb79fc4cecedcf174640f1b5796f08" \
    -d"username=testuser1&password=123456" http://localhost:8000/api/users
Update a User
curl -i -X PUT --header "Authorization: Bearer 8012796bbedb79fc4cecedcf174640f1b5796f08" \
    -d"username=testuser1&active=1" http://localhost:8000/api/users/2
Delete a User
curl -i -X DELETE --header "Authorization: Bearer 8012796bbedb79fc4cecedcf174640f1b5796f08" \
    http://localhost:8000/api/users/2
Delete Users
curl -i -X DELETE --header "Authorization: Bearer 8012796bbedb79fc4cecedcf174640f1b5796f08" \
    -d"rm_users[]=2&rm_users[]=3" http://localhost:8000/api/users

Top

Console Access

The application comes with a simple console interface to assist with application management from the CLI as well. You can build upon this to add console-level features and functionality

$ ./app users                      List users
$ ./app users add                  Add a user
$ ./app users username <user>      Change a user's username
$ ./app users password <user>      Change a user's password
$ ./app users -a <user>            Activate a user
$ ./app users -d <user>            Deactivate a user
$ ./app users clear <user>         Clear a user's failed login attempts
$ ./app users revoke <user>        Revoke a user's auth tokens
$ ./app users remove <user>        Remove a user

$ ./app version                    Show the version
$ ./app help                       Show the help screen

Top

popphp/pop-bootstrap 适用场景与选型建议

popphp/pop-bootstrap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 107 次下载、GitHub Stars 达 3, 最近一次更新时间为 2016 年 07 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 popphp/pop-bootstrap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 popphp/pop-bootstrap 我们能提供哪些服务?
定制开发 / 二次开发

基于 popphp/pop-bootstrap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 107
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-07-12