Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 49 | All time: 10,716 This week: 68 |
Version | License | PHP version | Categories | |||
laravel-plugins 1.0.0 | The PHP License | 5 | PHP 5, Libraries, Language, Design Pa... |
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(\Astutesixface\LaravelPlugins\PluginServiceProvider::class);
For Laravel add to 'providers' array in config/app.php:
\Astutesixface\LaravelPlugins\PluginServiceProvider::class,
Plugins must be in app/Plugins. Example plugin structure: - Test - Http
- Controllers
- TestController.php
- views
- test.blade.php
- migrations
- 2018_06_15_000000_create_test_table.php
- routes.php - TestPlugin.php
The TestPlugin class must extend the Astutesixface\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.
see examples/extend
Files (14) |
File | Role | Description | ||
---|---|---|---|---|
.github (1 directory) | ||||
examples (1 directory) | ||||
src (5 files) | ||||
composer.json | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files (14) | / | examples | / | extend |
File | Role | Description | ||
---|---|---|---|---|
Test (2 files, 2 directories) | ||||
TestExtension (1 file, 1 directory) |
Files (14) | / | examples | / | extend | / | Test |
File | Role | Description | ||
---|---|---|---|---|
Http (1 directory) | ||||
views (1 file) | ||||
routes.php | Class | Class source | ||
TestPlugin.php | Class | Class source |
Files (14) | / | examples | / | extend | / | Test | / | Http | / | Controllers |
File | Role | Description |
---|---|---|
TestController.php | Class | Class source |
Files (14) | / | examples | / | extend | / | Test | / | views |
File | Role | Description |
---|---|---|
test.blade.php | Aux. | Auxiliary script |
Files (14) | / | examples | / | extend | / | TestExtension |
File | Role | Description | ||
---|---|---|---|---|
Plugins (1 directory) | ||||
TestExtensionPlugin.php | Class | Class source |
Files (14) | / | examples | / | extend | / | TestExtension | / | Plugins | / | Test |
File | Role | Description | ||
---|---|---|---|---|
Http (1 directory) |
Files (14) | / | examples | / | extend | / | TestExtension | / | Plugins | / | Test | / | Http |
File | Role | Description | ||
---|---|---|---|---|
Controllers (1 file) |
Files (14) | / | examples | / | extend | / | TestExtension | / | Plugins | / | Test | / | Http | / | Controllers |
File | Role | Description |
---|---|---|
TestController.php | Class | Class source |
Files (14) | / | src |
File | Role | Description |
---|---|---|
ClassLoader.php | Class | Class source |
Plugin.php | Class | Class source |
PluginExtender.php | Class | Class source |
PluginManager.php | Class | Class source |
PluginServiceProvider.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.