Package Data | |
---|---|
Maintainer Username: | XalidBalagozov |
Maintainer Contact: | xalidbalagozov@gmail.com (Xalid Balagozov) |
Package Create Date: | 2019-05-24 |
Package Last Update: | 2019-05-24 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-03 03:03:19 |
Package Statistics | |
---|---|
Total Downloads: | 5 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Plugin system for Laravel 5.x and Lumen 5.x. Plugins can overwrite and extend each other.
For Lumen add to bootstrap/app.php:
$app->register(\CodFee\LaravelPlugins\PluginServiceProvider::class);
For Laravel add to 'providers' array in config/app.php:
\CodFee\LaravelPlugins\PluginServiceProvider::class,
Plugins must be in app/Plugins. Example plugin structure:
The TestPlugin class must extend the CodFee\LaravelPlugins\Plugin class, containing a unique $name property and a boot() method.
In the boot() method of your plugin call $this->enableViews()
.
Optional you can pass a relative path to the views directory, default to views
.
Views automatically have a namespace ("plugin:{name}"
), the name is defined by the the main plugin class in a camel case format, with Plugin
stripped from the end. For the example above it would be plugin:test
.
To render a view you can either write the namespace yourself or use the helper method view()
in the plugin class. For example view('plugin:test::some.view.name');
In the boot() method of your plugin call $this->enableRoutes()
.
Optional you can pass a relative path to the routes file, default to routes.php
.
You automatically have access to the $app
variable.
Routes are automatically grouped to your plugin namespace, so you only have to type the controller name without the namespace.
Controllers must be in PluginDirectory->Http->Controllers.
In the boot() method of your plugin call $this->enableMigrations()
.
Optional you can pass a relative path to the migrations directory, default to migrations
.
Keep in mind that migrations must follow the yyyy_mm_dd_tttt_<name>.php
naming convention, for example 2014_10_12_000000_create_users_table.php
would be a valid migration.