PHPackages                             aaron-lin/internal-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. aaron-lin/internal-api

ActiveLibrary[API Development](/categories/api)

aaron-lin/internal-api
======================

10PHP

Since May 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Aaron2963/internal_api)[ Packagist](https://packagist.org/packages/aaron-lin/internal-api)[ RSS](/packages/aaron-lin-internal-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Internal API Documentation
==========================

[](#internal-api-documentation)

- [Introduction](#introduction)
- [Authorization](#authorization)
- [1. Client Cache](#1-client-cache)
    - [1.1 Create Cache on Client](#11-create-cache-on-client)
- [2. File Transfer](#2-file-transfer)
    - [2.1 Download File](#21-download-file)
    - [2.2 Upload File](#22-upload-file)

Introduction
------------

[](#introduction)

This document describes the internal API of the application. The internal API is used in communication of backend. The internal API is not exposed to the public and is only used by the backend.

Authorization
-------------

[](#authorization)

The followinig API are authorized with Bearer-type tokens. Remote servers must send API key through HTTP header `Authorization` with Bearer-type token. The API key is generated by backend and is unique for each remote server. The API key is used to identify the remote server. Hashed API keys are stored in file system. The API key is generated by the following command:

```
$NewApiKey = random_bytes(40);
$HashedApiKey = crypt($newApiKey, 'salt');  //server only stores hashed API key
```

And the API keys storage file example is [here](example/api_keys.json.example).

1. Client Cache
---------------

[](#1-client-cache)

### 1.1 Create Cache on Client

[](#11-create-cache-on-client)

```
POST /iapi/cache

```

Remote server request server to create cache on server file system.

#### Request: String in HTTP Header, Parameter(s) in HTTP Body

[](#request-string-in-http-header-parameters-in-http-body)

Header

NameTypeDescription`Authorization``string`**(Required)** Bearer type token，token content is API Key```
Authorization: Bearer b01fd1c05d93e77a887fa6c8c91088bb7f053fb220eaf87d51e5efa30fea9d25

```

Body

NameTypeDescription`fromDB``string`**(Required)** source database table and column name`storePath``string`**(Required)** the path of directory storing caches`keys``string`**(Required)** the primary keys of caching data, splited by comma, the number of keys must be identical with the number of filenames`filenames``string`**(Required)** the filename of caches, splited by comma, the number of filenames must be identical with the number of keys```
fromDB: user_info.intro_json
storePath: ./cache/user-intro
keys: id001,id002,id003
filenames: about-us.json,contact-us.json,privacy-policy.json

```

#### Success Response: String in HTTP Header

[](#success-response-string-in-http-header)

```
Status: 200 OK

```

```
[
    "/var/www/cache/user-intro/about-us.json",
    "/var/www/cache/user-intro/contact-us.json",
    "/var/www/cache/user-intro/privacy-policy.json"
]
```

#### Error Response

[](#error-response)

```
Status: 400 Bad Request

```

```
{
    "status": "error",
    "message": "keys and filenames count not match"
}
```

2. File Transfer
----------------

[](#2-file-transfer)

### 2.1 Download File

[](#21-download-file)

```
GET /iapi/file

```

Remote server download file from server.

#### Request: String in HTTP Header, Parameter(s) in Query String

[](#request-string-in-http-header-parameters-in-query-string)

Header

NameTypeDescription`Authorization``string`**(Required)** Bearer type token，token content is API Key```
Authorization: Bearer b01fd1c05d93e77a887fa6c8c91088bb7f053fb220eaf87d51e5efa30fea9d25

```

Query String

NameTypeDescription`filename``string`**(Required)** path and filename of downloading file```
https://example.com/iapi/file?filename=public/images/1.jpg

```

#### Success Response: String in HTTP Header

[](#success-response-string-in-http-header-1)

```
Status: 200 OK
Content-Type: image/jpg

```

#### Error Response

[](#error-response-1)

```
Status: 400 Bad Request

```

```
{
    "status": "error",
    "message": "keys and filenames count not match"
}
```

### 2.2 Upload File

[](#22-upload-file)

```
POST /iapi/file

```

Remote server upload file to server.

#### Request: String in HTTP Header, Parameter(s) in HTTP Body

[](#request-string-in-http-header-parameters-in-http-body-1)

Header

NameTypeDescription`Authorization``string`**(Required)** Bearer type token，token content is API Key```
Authorization: Bearer b01fd1c05d93e77a887fa6c8c91088bb7f053fb220eaf87d51e5efa30fea9d25

```

Body

NameTypeDescription`content``binary`**(Required)** uploading file`filename``string`**(Required)** path and filename of uploading file```
content: (binary)
filename: ./public/images/1.jpg

```

#### Success Response: String in HTTP Header

[](#success-response-string-in-http-header-2)

```
Status: 204 No Content

```

#### Error Response

[](#error-response-2)

```
Status: 400 Bad Request

```

```
{
    "status": "error",
    "message": "keys and filenames count not match"
}
```

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b46e3827bb5ee9e9b0eb05da5f21afa64dabc488035ab65d4970ce00b148313?d=identicon)[neotgrr](/maintainers/neotgrr)

---

Top Contributors

[![Aaron2963](https://avatars.githubusercontent.com/u/33084610?v=4)](https://github.com/Aaron2963 "Aaron2963 (6 commits)")

### Embed Badge

![Health badge](/badges/aaron-lin-internal-api/health.svg)

```
[![Health](https://phpackages.com/badges/aaron-lin-internal-api/health.svg)](https://phpackages.com/packages/aaron-lin-internal-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
