定制 redsky/clean-api 二次开发

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

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

redsky/clean-api

Composer 安装命令:

composer create-project redsky/clean-api

包简介

PHP Clean Architecture API REST

README 文档

README

<<<<<<< HEAD Absolutely! Let’s summarize what I remember about skynet-api and then create a full README.md draft for it.

What I remember about skynet-api

  • It's the backend REST API for your Skynet projects.
  • Provides endpoints for user authentication and registration (at least /auth/register).
  • Returns JSON responses, including proper validation errors.
  • Works with skynet-ui as the frontend and skynet-core for API client and helpers.
  • Uses HTTP status codes to indicate success (2xx) or errors (4xx for validation, 5xx for server errors).
  • Can be consumed via the ApiClient from skynet-core.

Draft README.md for skynet-api

# Skynet API

**Skynet API** is a RESTful backend service for the Skynet project.  
It provides endpoints for user authentication, registration, and other resources to be consumed by frontend applications like **skynet-ui**.

---

## Features

- **User Authentication & Registration**
  - `POST /auth/register` → Register a new user
  - `POST /auth/login` → Authenticate a user (planned)
  - Validation with proper HTTP error codes
- **JSON Responses**
  - Standardized response format
  - Returns `errors` for validation failures
  - Uses HTTP status codes for success and errors
- **Robust API Design**
  - RESTful conventions
  - Easily extendable for future resources
- **Integrates with Skynet UI and Core**
  - Can be consumed with `Core\Http\Client\ApiClient` from `skynet-core`

---

## Installation

Clone the repository:

```bash
git clone https://github.com/Julioxfiles/skynet-api.git
cd skynet-api

Install dependencies:

composer install

Set up environment variables:

cp .env.example .env

Configure database credentials and other settings in .env.

Usage

Register a User

Endpoint: POST /auth/register

Request Body (JSON):

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "secret",
  "password_confirmation": "secret"
}

Success Response:

{
  "status": 201,
  "message": "User registered successfully",
  "data": {
    "id": 1,
    "name": "John Doe",
    "email": "john@example.com"
  }
}

Validation Error Response (422):

{
  "status": 422,
  "message": "Validation failed",
  "errors": {
    "email": ["The email field is required."],
    "password": ["The password must be at least 6 characters."]
  }
}

Integration with Skynet UI

use Core\Http\Client\ApiClient;
use Core\Http\Exceptions\ApiValidationException;

$api = new ApiClient();

try {
    $response = $api->post('/auth/register', [
        'name' => 'John Doe',
        'email' => 'john@example.com',
        'password' => 'secret',
        'password_confirmation' => 'secret'
    ]);

    if ($response->isSuccess()) {
        echo "User registered successfully!";
    }

} catch (ApiValidationException $e) {
    print_r($e->errors());
}

Folder Structure (example)

skynet-api/
├─ app/
│  ├─ Http/
│  │  ├─ Controllers/
│  │  └─ Middleware/
├─ routes/
│  └─ api.php
├─ database/
│  ├─ migrations/
│  └─ seeders/
├─ composer.json
├─ .env.example
└─ README.md

License

MIT


---

If you want, I can **also make a shorter, GitHub-friendly “About” version** for `skynet-api` just like we did for `skynet-ui` and `skynet-core`.  

Do you want me to do that?

=======

SkynetApi

This is a Clean Architectural API starting proyect.

9f0501da6550a47bcd97870ced6ea08097d5cf6f

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-03-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固