PHPackages                             alone-webman/js - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. alone-webman/js

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

alone-webman/js
===============

前端js

043PHP

Since Jun 25Pushed 10mo agoCompare

[ Source](https://github.com/alone-webman/js)[ Packagist](https://packagist.org/packages/alone-webman/js)[ RSS](/packages/alone-webman-js/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

前端js
====

[](#前端js)

### 安装

[](#安装)

```
composer require alone-webman/js

```

### 命令

[](#命令)

```
php webman alone:js

```

### 加载css和js

[](#加载css和js)

```
/**
 *
 * @param {function|Array} [callback]
 * @param {function|Array} [loading]
 */
function alone_app(callback, loading = []) {
    loading = typeof loading === 'undefined' ? JSON.parse("%loaderIng%") : loading;
    const call = typeof callback === 'function' ? callback : (typeof loading === 'function' ? loading : () => null);
    const load = Array.isArray(callback) ? callback : (Array.isArray(loading) ? loading : []);
    let length = load.length;
    load.forEach(function (file) {
        if (file.toLowerCase().endsWith('.css')) {
            const link = document.createElement('link');
            link.setAttribute('href', file);
            link.setAttribute('type', 'text/css');
            link.setAttribute('rel', 'stylesheet');
            link.onload = () => (length--, (length === 0) && call());
            document.head.appendChild(link);
        } else {
            const script = document.createElement('script');
            script.setAttribute('type', 'text/javascript');
            script.setAttribute('src', file);
            script.onload = () => (length--, (length === 0) && call());
            document.body.appendChild(script);
        }
    });
}
```

### 使用

[](#使用)

```

    vue

    alone_app(function () {
        const {createApp} = Vue;
        const {createRouter, createWebHashHistory} = VueRouter;
        const {createI18n} = VueI18n;
        const router = createRouter({
            history: createWebHashHistory(), routes: [
                {
                    path: '/',
                    component: {
                        template: '{{ $t("home.welcome") }}'
                    }
                },
                {
                    path: '/about',
                    component: {
                        template: '{{ $t("about.title") }}'
                    }
                }
            ]
        });
        const i18n = createI18n({
            locale: 'zh', fallbackLocale: 'en', messages: {
                zh: {
                    home: {
                        welcome: '欢迎来到首页'
                    },
                    about: {
                        title: '关于我们'
                    }
                },
                en: {
                    home: {
                        welcome: 'Welcome to Home'
                    },
                    about: {
                        title: 'About Us'
                    }
                }
            }
        });
        const app = createApp({});
        app.use(router);
        app.use(i18n);
        app.mount('#app');
        window.changeLanguage = function (locale) {
            i18n.global.locale = locale;
        };
    });

```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

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/1c6a1452b0598af23c8cf24d868ce58f81436f9a16e487ceaa202c463c31f371?d=identicon)[zhqingphp](/maintainers/zhqingphp)

### Embed Badge

![Health badge](/badges/alone-webman-js/health.svg)

```
[![Health](https://phpackages.com/badges/alone-webman-js/health.svg)](https://phpackages.com/packages/alone-webman-js)
```

PHPackages © 2026

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