PHPackages                             aaron-lin/app-php - 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. [Framework](/categories/framework)
4. /
5. aaron-lin/app-php

ActiveLibrary[Framework](/categories/framework)

aaron-lin/app-php
=================

A PHP framework for web app.

1.0.0(1y ago)177↓50%MITPHPPHP &gt;=7.4

Since Mar 24Pushed 1y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (5)Versions (12)Used By (0)

Lin/App-PHP
===========

[](#linapp-php)

Installation
------------

[](#installation)

```
$ composer require aaron-lin/app-php
```

Usage
-----

[](#usage)

There are three types of supported PHP applications: **RESTful App**, **CRUD App** and **Single Page App**.

### RESTful App

[](#restful-app)

To build RESTful App, extend the `Lin\AppPhp\Server\RestfulApp` class, and override the `OnGet|OnPost|OnPut|OnDelete|OnPatch` methods.

For detailed example, see [example/restful\_app.php](example/restful_app.php).

### CRUD App

[](#crud-app)

To build CRUD App which only accept `POST` method and receive command from resource path, extend the `Lin\AppPhp\Server\CrudApp` class, and override the `OnCreate|OnRead|OnUpdate|OnDelete` methods.

For detailed example, see [example/crud\_app.html](example/crud_app.html) and [example/crud\_app.select.php](example/crud_app.select.php).

### Single Page App

[](#single-page-app)

To build single page app, instanciate the `Lin\AppPhp\Server\SinglePageApp` class, and pass the web page html code as string to the constructor, and call `AddPostAction` method to add actions for receiving post requests.

For detailed example, see [example/single\_page\_example.html](example/single_page_example.html) and [example/single\_page\_app.php](example/single_page_app.php).

### Authorization

[](#authorization)

To implement authorization:

1. create a class implementing `Lin\AppPhp\Authorization\AuthorizationInterface` interface, and implement the `Authorize($Token, $RequestScopes = [])` method
2. pass the instance to `WithAuthorization` method of `Lin\AppPhp\Server\App` class
3. call `AuthorizeRequest` method of `Lin\AppPhp\Server\App` class to check authorization

```
require __DIR__ . '/vendor/autoload.php';

use Lin\AppPhp\Server\App;
use Lin\AppPhp\Server\RestfulApp;
use Lin\AppPhp\Authorization\AuthorizationInterface;

// 實作 AuthorizationInterface
class Authorization implements AuthorizationInterface
{
    public function Authorize($Token, $RequestScopes = []): bool
    {
        $AvailableScopes = ['user.read', 'user.create'];
        $AccessScopes = array_intersect($RequestScopes, $AvailableScopes);
        if (count($RequestScopes) > 0 && count($AccessScopes) === 0) {
            return false;
        }
        return true;
    }
}

class User extends RestfulApp
{
    public function OnGet()
    {
        // 檢查權限: 呼叫 App::AuthorizeRequest
        if (!$this->AuthorizeRequest(['user.read'])) {
            return App::UnauthorizedResponse();
        }
        // 回應
        return App::NoContentResponse();
    }
}

// 處理請求
$App = new User();
$App->WithAuthorization(new Authorization())->HandleRequest(App::CreateServerRequest());
$App->SendResponse();
exit;
```

For OAuth2 authorization with JWT, use `Lin\AppPhp\Authorization\OAuthAuthorization` class:

1. create a class extending `Lin\AppPhp\Authorization\OAuthAuthorization` class, and implement the `IsTokenRevoked($JTI)` method
2. pass the instance to `WithAuthorization` method of `Lin\AppPhp\Server\App` class
3. call `AuthorizeRequest` method of `Lin\AppPhp\Server\App` class to check authorization

```
require __DIR__ . '/vendor/autoload.php';

use Lin\AppPhp\Server\App;
use Lin\AppPhp\Server\RestfulApp;
use Lin\AppPhp\Authorization\AuthorizationInterface;

// 實作 AuthorizationInterface
class Authorization extends OAuthAuthorization
{
    public function IsTokenRevoked($JTI)
    {
        // 檢查 token 是否被撤銷
        return false;
    }
}

class User extends RestfulApp
{
    public function OnGet()
    {
        // 檢查權限: 呼叫 App::AuthorizeRequest
        if (!$this->AuthorizeRequest(['user.read'])) {
            return App::UnauthorizedResponse();
        }
        // 回應
        return App::NoContentResponse();
    }
}

// 處理請求
$PublicKeyPath = '/var/www/pubkeys/oauth_pub';
$App = new User();
$App->WithAuthorization(new Authorization($PublicKeyPath))->HandleRequest(App::CreateServerRequest());
$App->SendResponse();
exit;
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~50 days

Recently: every ~94 days

Total

11

Last Release

642d ago

Major Versions

v0.4.3 → 1.0.02024-08-13

### 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 (57 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aaron-lin-app-php/health.svg)

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

###  Alternatives

[aimeos/aimeos-typo3

Professional, full-featured and high performance TYPO3 e-commerce extension for online shops and complex B2B projects

1.5k91.2k4](/packages/aimeos-aimeos-typo3)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73142.3k25](/packages/jaxon-php-jaxon-core)[slack-php/slack-app-framework

Provides a foundation upon which to build a Slack application in PHP

4933.4k1](/packages/slack-php-slack-app-framework)

PHPackages © 2026

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