irpcpro/tele-link

Tele Link (链接缩短工具) 是一个纯PHP项目,使用了自定义的微框架。

安装: 4

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 1

分支: 0

开放问题: 0

类型:项目

1.0.0 2023-01-13 15:21 UTC

This package is auto-updated.

Last update: 2024-09-30 01:43:40 UTC


README

版本: 1.0.0

链接缩短系统(PHP)是一个纯PHP项目,使用了自定义的微框架。

Latest Stable Version Total Downloads License PHP Version Require

安装

使用Composer安装此项目

composer create-project irpcpro/tele-link
需求
  • php: "^7.4",
  • vitodtagliente/pure-routing: "^1.0",
  • rych/phpass: "^2.0",
  • firebase/php-jwt: "^6.3",
  • ext-json: "*",
  • ext-mysqli: "*"

数据库配置

为了设置数据库配置,请编辑 config/app-config.php


创建默认数据库表

运行此脚本以创建数据库表

~ composer run-script sql-creator

运行应用程序

要运行应用程序,只需在 .\public\ 运行服务器

~ cd .\public\
~ php -S localhost:8080

或在 .\public\ 目录中运行服务器。


路由

- 登录 [POST]
{{host}}/api/v1/user/login
{
    "username": "admin",
    "password": "123"
}

- 创建链接 [POST]

⚠️ 需要授权

{{host}}/api/v1/shortener/create
{
    "link": "https://facebook.com"
}

- 获取所有链接 [GET]

⚠️ 需要授权

{{host}}/api/v1/shortener/get-all?limit=10

- 删除链接 [DELETE]

⚠️ 需要授权

{{host}}/api/v1/shortener/delete/{link_id}

- 编辑链接 [EDIT]

⚠️ 需要授权

{{host}}/api/v1/shortener/edit
{
    "link_id": 5,
    "link": "http://google-new.com"
}