PHPackages                             enlivenapp/flight-school - 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. enlivenapp/flight-school

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

enlivenapp/flight-school
========================

Plugin loader and discovery for FlightPHP plugins

0.3.1(2mo ago)02419MITPHPPHP ^8.1

Since Apr 15Pushed 2mo agoCompare

[ Source](https://github.com/enlivenapp/FlightPHP-Flight-School)[ Packagist](https://packagist.org/packages/enlivenapp/flight-school)[ RSS](/packages/enlivenapp-flight-school/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (3)Versions (11)Used By (19)

[![Stable? Not Quite Yet](https://camo.githubusercontent.com/8712c441bb32fd8db507e0008c5d13e30def50064f8fcbc689fbcf5191f7d2af/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737461626c652533462d6e6f7425323071756974652532307965742d626c75653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/enlivenapp/flight-school)[![License](https://camo.githubusercontent.com/80d79f563cfb8dd2089e710a08cfe3fd214d23305e23179338e1b52aff4d8553/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656e6c6976656e6170702f666c696768742d7363686f6f6c3f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/enlivenapp/flight-school)[![PHP Version](https://camo.githubusercontent.com/f2b631d6ad5c660f9fed68eee1aeba37223fbaaf6a61067ac15df78e23439317/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f656e6c6976656e6170702f666c696768742d7363686f6f6c3f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/enlivenapp/flight-school)[![Monthly Downloads](https://camo.githubusercontent.com/55d01fe32915e035e67013f25081156b935af4bb918405d3b18aa3107f85e411/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f656e6c6976656e6170702f666c696768742d7363686f6f6c3f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/enlivenapp/flight-school)[![Total Downloads](https://camo.githubusercontent.com/62b0fad8387058742fa5a59c26f6c410ddb579a36fc7df84e1583121b6a901af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e6c6976656e6170702f666c696768742d7363686f6f6c3f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/enlivenapp/flight-school)[![GitHub Issues](https://camo.githubusercontent.com/8601f1091acb59cc664a3a2f91670604a6bf9f5b0e20177b30f7f261be4ed044/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f656e6c6976656e6170702f466c696768745048502d466c696768742d5363686f6f6c3f7374796c653d666f722d7468652d6261646765)](https://github.com/enlivenapp/FlightPHP-Flight-School/issues)[![Contributors](https://camo.githubusercontent.com/3cc3f1a34657eba5371232af399bce10797b4d6d38498592c36c120819e6ce1d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f656e6c6976656e6170702f466c696768745048502d466c696768742d5363686f6f6c3f7374796c653d666f722d7468652d6261646765)](https://github.com/enlivenapp/FlightPHP-Flight-School/graphs/contributors)[![Latest Release](https://camo.githubusercontent.com/2bd5c477a7e6d6e9626920286a061aa54e097a11f4714ee459535a7629f9301d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f656e6c6976656e6170702f466c696768745048502d466c696768742d5363686f6f6c3f7374796c653d666f722d7468652d6261646765)](https://github.com/enlivenapp/FlightPHP-Flight-School/releases)[![Contributions Welcome](https://camo.githubusercontent.com/9db3f8b82ea88469efd296a9305fc00f40b4c9450bb6b539d42d339fa6963444/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6e747269627574696f6e732d77656c636f6d652d626c75653f7374796c653d666f722d7468652d6261646765)](https://github.com/enlivenapp/FlightPHP-Flight-School/pulls)

Flight School
=============

[](#flight-school)

Composer based plugin support for FilghtPHP.

- **Automatic boot order** for plugin files (`Config.php`, `Routes.php`, `AdminRoutes.php`) with `$app` and `$router` available
- **Auto-prefixed config and routes management** so plugins don't step on each other
- **Enable/disable** plugins in `app/config/config.php`
- **Priority-based load ordering** between plugins
- **View overrides** so the host app can replace any plugin view
- **Cross-plugin discovery** via `getPaths()` (migrations, seeds, etc.)
- **CLI commands** to list, info, sync, enable, and disable plugins
- **Security** checks (path containment, symlink rejection)

v 0.2.2

- introduced support for enlivenapp/migrations
- removed Cycle ORM suport

Plugins use FlightPHP's `Engine` and `Router` directly, no wrapper APIs.

Requirements
------------

[](#requirements)

- PHP 8.1+
- A [FlightPHP skeleton project](https://github.com/flightphp/skeleton).

```
composer create-project flightphp/skeleton my-project
cd my-project
```

or `composer create-project flightphp/skeleton .` to install in the same directory.

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

[](#installation)

```
composer require enlivenapp/flight-school
```

Composer will ask you to trust the plugin. Type `y`. This allows Flight School to set itself up your project:

> *We recommend always reviewing someone elses' code before installing it*

1. Adds the plugin loader service to `app/config/services.php`
2. Adds a `plugins` section to `app/config/config.php` and `config_sample.php`

Plugins are disabled by default. Enable them in `config.php` by setting `'enabled' => true` or use runway: `php runway plugins:enable [vendor/package]`.

Writing a Plugin
----------------

[](#writing-a-plugin)

Check out [Flight Factory](https://github.com/enlivenapp/FlightPHP-Factory)

Plugin Discovery
----------------

[](#plugin-discovery)

The Plugin Loader loads Composer package automatically.

**composer.json** Flight School looks for any Composer package with a `type` starting with `flightphp-` is treated as a plugin. Flight School reads the PSR-4 namespace from `vendor/composer/installed.json` and loads the plugin's `src/Config/` files automatically. If a `Plugin` class exists (e.g. `YourVendor\YourPlugin\Plugin`), its `register()` method is called after.

```
{
    "name": "enlivenapp/hello-world-plugin",
    "description": "Reference FlightPHP plugin demonstration for FlightSchool",
    "type": "flightphp-plugin",
...
}

```

When you `composer require` a `flightphp-*` package, its config entry is added automatically (disabled).

### src/Config/\*

[](#srcconfig)

All files in this folder are optional.

Flight::app() as `$app` is available in Config.php, so you can also call `$app->set()` directly. Values set this way are **not** prefixed — they go into `$app` exactly as written. Use the return array for plugin config that should be prefixed, and `$app->set()` for anything that intentionally needs a global key.

Flight::router as `$router` is available.

**Services don't need registration.** Composer autoloading makes all plugin classes available by their full name. Just use them directly:

```
$mailer = new \MyVendor\MyPlugin\Services\Mailer();
```

### src/Config/Config.php

[](#srcconfigconfigphp)

- sets prefixes and returns config values. Put `configPrepend` and `routePrepend` inside the returned array. The PluginLoader stores the returned array on `$app` with the config prefix applied, so two plugins can't overwrite each other's config:

```
