PHPackages                             eru123/wyue - 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. eru123/wyue

ActiveLibrary[Framework](/categories/framework)

eru123/wyue
===========

Framework for developing Vite.js application on top of PHP

0184PHP

Since Aug 6Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/eru123/wyue)[ Packagist](https://packagist.org/packages/eru123/wyue)[ RSS](/packages/eru123-wyue/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Wyue
====

[](#wyue)

Framework for developing Vite.js application on top of PHP

On my recent projects, I've developed different applications using PHP as API and Vue 3 with Vite on the frontend, I successfully combined these technologies into a single project, even worked with Hot Module Replacement (HMR) for development, and added meta data to my Vue application for better Search Engine Optimization (SEO). When I'm starting new projects, I copied the codes from the previous project and use it as my boiler plate, then added new features and functionalities, then I also update the other old project for bug fixes and add the new features from other projects, that's kind of a mess on my part and exhausting, so I decided to create this framework to make my life easier and more organized. As this project helps me build my projects, I hope someone can use it too and give it a try, if you like it you can also leave a star or fund this project, I would also appreciate any feedback.

Features
========

[](#features)

Routing
-------

[](#routing)

To start with routing you must first use the Route namespace

```
use Wyue\Route;
```

To understand the route handlers and middlewares, here is an example of how to define a handler function first

```
$handler = function (Route $context, $result = null) {
    // process handler
}
```

For the response, you can set the [http response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) using `code` method

```
$handler = function (Route $context, $result = null) {
    $context->code(202);
    return 'OK'; // response with html/text
}
```

Think of handlers as data pipelines, where the result of the previous one is passed to the next one

```
$analyticsHandler = function (Route $context, $result = null) {
    // does not return anything, just processing some background tasks
}

$authHandler = function (Route $context, $result = null) {
    // for the example, we assume that the request failed to send valid credentials so we want to invalidate it
    // if you return false in a handler it will stop processing the next handlers and proceed to process the next routes
    return false;

    // Alternatively, you can just throw an exception with http error codes
    throw new Exception("Forbidden", 403);

    // You could also return a json response by returning an array
    $context->code(403);
    return [
        "code" => 403,
        "error" => "Forbidden",
        "message" => "Please login to access!",
    ];
}

$apiHandler = function (Route $context, $result = null) {
    // since you return false from previous handler, you will not reach this code
}

$route = new Route();
$route->Route('/api/users', $analyticsHandler, $authHandler, $apiHandler);
$route->Route('/api/user/2', $analyticsHandler, $authHandler, $apiHandler);
$route->Route('/api/user/3', $analyticsHandler, $authHandler, $apiHandler);
$route->Route('/api/user/4', $analyticsHandler, $authHandler, $apiHandler);
```

Using `Route` method allows you to process routes without restiction on request method, to add a restriction on request method you can use following functions: `Get`, `Post`, `Put`, `Patch`, `Delete`

```
$route = new Route();
$route->Get('/api/user', $analyticsHandler, $apiHandler);
$route->Post('/api/user', $analyticsHandler, $authHandler, $apiHandler);
```

If you are used with Laravel or Codeigniter, they have some magic to call route handler functions, I somehow implemented their way of calling its route handler functions.

```
class AuthController {
    public function login(Route $context, $result = null) {
        // process login here
    }

    // ...
}

function loginFunction(Route $context, $result = null) {
    // process login here
}

// Different ways to call route handler functions
$auth = new AuthController();
$route->Post('/login', [$auth, 'login']); // I believe this is the most recommended way for performance reasons
$route->Post('/login', [AuthController::class, 'login']);
$route->Post('/login', 'AuthController@login');
$route->Post('/login', 'AuthController::login');
$route->Post('/login', 'loginFunction');
```

With Wyue, you can also define a url parameters in different ways and get it's value from the context with `Params` method

```
// actual url path: /api/user/1

class UserController {
    public function user(Route $context, $result = null) {
        // process user here
        $id = $context->Params('id', 'default value if id not exist in url');
        // or
        $id = $context->Params()['id'];
    }
}

$route->Get('/api/user/{id}', 'UserController::user');
$route->Get('/api/user/$id', 'UserController::user');
$route->Get('/api/user/:id', 'UserController::user');
```

If you want something more complex ways of defining your Routes, try nested routes by creating a new Route inside the handler function

```
$route->Route('/api', function (Route $route) {
    $route->Route('/user/$id', function (Route $route) {
        $route->Delete('/delete', function (Route $route) {
            // delete user
        })

        $route->Put('/update', function (Route $route) {
            // update user
        })

        return [
            // ... user details
        ];
    });

    $route->Get('/users', function (Route $route) {
        // list users
    });

    return [
        // ... fallback
    ];
})
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity14

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/05166f465b8d50e88f58c04319272489cffe23c3b85360244973f973e18c1c0f?d=identicon)[eru123](/maintainers/eru123)

---

Top Contributors

[![eru123](https://avatars.githubusercontent.com/u/39824083?v=4)](https://github.com/eru123 "eru123 (113 commits)")

### Embed Badge

![Health badge](/badges/eru123-wyue/health.svg)

```
[![Health](https://phpackages.com/badges/eru123-wyue/health.svg)](https://phpackages.com/packages/eru123-wyue)
```

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k39.6M298](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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