enlivenapp/hello-world-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

enlivenapp/hello-world-plugin

Composer 安装命令:

composer require enlivenapp/hello-world-plugin

包简介

Reference FlightPHP plugin demonstrating proper MVC structure for FlightSchool

README 文档

README

Stable? Not Quite Yet License PHP Version Monthly Downloads Total Downloads GitHub Issues Contributors Latest Release Contributions Welcome

Hello World Plugin

A reference plugin for FlightPHP apps using the FlightSchool plugin loader. Use it as a starting point when building your own plugin.

What it demonstrates

  • Returning config values with auto-prefixed keys (Config/Config.php)
  • Defining routes that get auto-prefixed by the PluginLoader (Config/Routes.php)
  • Three different ways to get a config value into a controller method
  • Providing views that the host app can override
  • Creating runway commands

Config and route prefixes

The PluginLoader auto-prefixes config keys and routes based on the package name so plugins don't step on each other. This plugin's defaults are:

Default With override uncommented
Config key enlivenapp.hello-world-plugin hello-world
Route prefix /enlivenapp_hello_world_plugin /hello-world

To use the shorter versions, set configPrepend and routePrepend inside the returned array in src/Config/Config.php.

Plugin structure

src/
  Plugin.php                  <- Optional. Called after Config/ files are loaded.
  commands/
    HelloWorldCommand.php   <- Runway CLI command (must be lowercase, see below).
  Config/
    Config.php              <- Config values and optional prepend overrides. Loaded first.
    Services.php            <- Documentation only. Services use Composer autoloading.
    Routes.php              <- Routes. Auto-wrapped in a prefix group by the PluginLoader.
  Controllers/
    HelloController.php     <- Handles requests. Three methods, three patterns.
  Views/
    index.php               <- Default view for the /hello route.
    app-override-index.php  <- Copy this to override the view (see below).

Note: commands/ must be lowercase. Runway discovers command files by scanning the filesystem directly, not through Composer's autoloader. All other directories follow PSR-4 convention (uppercase).

Installation

composer require enlivenapp/hello-world-plugin

Configuration

When Composer installs the plugin, FlightSchool adds an entry to app/config/config.php:

'enlivenapp/hello-world-plugin' => [
    'enabled' => false,
    'priority' => 50,
],

To activate the plugin, change 'enabled' to true.

Config values live in src/Config/Config.php. The PluginLoader stores the returned array on $app under the config prepend key. To change a value, edit that file directly.

Flight School config

This package uses Flight School's return-array config format. src/Config/Config.php returns the package defaults as an array, Flight School stores that array under enlivenapp.hello-world-plugin on $app, and prepend overrides belong inside that returned array instead of as standalone variables.

The current example uses:

return [
    // 'configPrepend' => 'hello-world',
    'routePrepend' => 'hello-world',
    'greeting' => 'Hello from a vendor plugin!',
];

Reading config

$app is available in Config/ files, route files, and controllers (passed to the constructor). Read the full config array, then index into it:

$config = $app->get('enlivenapp.hello-world-plugin');
$greeting = $config['greeting'];

Models and services don't receive $app automatically — pass the values they need as parameters.

Routes

The PluginLoader wraps all routes in a prefix group automatically. With the default prefix:

Route Response How it gets the greeting
GET /enlivenapp_hello_world_plugin HTML view Passed as a method parameter from Routes.php
GET /enlivenapp_hello_world_plugin/hola JSON Reads $this->config (set in the constructor)
GET /enlivenapp_hello_world_plugin/hello HTML view Passed as a method parameter from Routes.php
GET /enlivenapp_hello_world_plugin/hallo JSON Reads config from $app->get() in the method

With 'routePrepend' => 'hello-world' set in the returned config array, routes become /hello-world, /hello-world/hola, etc.

Overriding views

The plugin includes a ready-to-use override template. Copy it to your app's views directory:

cp vendor/enlivenapp/hello-world-plugin/src/Views/app-override-index.php \
   app/views/enlivenapp/hello-world-plugin/index.php

You may need to create the directory first:

mkdir -p app/views/enlivenapp/hello-world-plugin

Once the override is in place, the plugin will use your version instead of its own.

License

MIT

enlivenapp/hello-world-plugin 适用场景与选型建议

enlivenapp/hello-world-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 enlivenapp/hello-world-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 enlivenapp/hello-world-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 enlivenapp/hello-world-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-16