Download the PHP package winkelco/laravel-extension without Composer
On this page you can find all versions of the php package winkelco/laravel-extension. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-extension
Laravel Extension
Plugin, Extension and Module System For Laravel. Inspirate from Wordpress Plugins.
Table of contents
- Installing
- Extension Management Page
- Extension Folder Structure
- Create New Extension
- with Artisan Command
- Manual
- Hook
- Action
- Filter
- Menu Builder
- Unit Test
- Examples
- Making Dynamic css and javascript in html blade
- License
Installing
Install from composer :
We make this package with Auto Discovery, but you can add manual :
Publish Config :
Added Namespace To Your Composer : (edit your laravel composer.json
)
And then, you can generate composer autoload :
For first time after installing, you must run this command for generate extension folder in app\Extension
:
Extension Management Page
For a simple Extension management page, added this route to your rourtes routes/web.php
:
Save, and then access in your browser http://mylaravelproject.test/extension
or 'localhost:8000/extension`, and finaly, you see this page :
Extension Folder Structure
By Default, Extension path in app/Extension
, you can create Extension in this folder.
Artisan Console Command Support
Make new extension easy :
Update list installed extension :
Get list installed extension :
Enable a extension : (plugin must be added in list first)
Disable a extension :
Inspect a Extension
Get Hook list (all)
Get Hook list specific type (action or filter)
Create New Extension
with Artisan Command
you can create new extension with this command :
after success, you can refresh extension list with :
and you can check if updating list success :
for enable your extension, use :
Manual
| note : this use indonesian language, you can translate this.
Lokasi extension harus ada pada folder utama extension, secara default
ada pada app\Extension
. berikut panduan singkat cara pembuatan extension :
- membuat folder utama extension, misal
app\Extension\MyPlugin
-
buat file config untuk plugin anda di
app\Extension\MyPlugin\extension.json
, isi dengan : -
Buat service provider untuk extension anda, di folder working extension tadi, sebagai contoh
app\Extension\MyPlugin\MyPluginServiceProvider.php
isinya : - Sekarang, jalankan perintah ini diartisan untuk mengupdate list extension yang terinstall di
app\Extension\extension.json
:
anda bisa menambahkanya otomatis di file config app\Extension\extension.json
, jika anda menjalankan perintah diatas, perintah tersebut akan otomatis mengupdate daftar extension anda yang ada di app\Extension\extension.json
, seharusnya menjadi seperti berikut nantinya file app\Extension\extension.json
:
-
Cek apakah extension tersebut sudah terdaftar dengan menjalankan perintah :
- jika terdaftar tapi statusnya belum
active
, silahkan jalankan perintah :
Hook
Action
with Hook Action, you can make multi-action system and management action.
Make Action :
Run Action :
For Example, you can make action hook name "save_post", and this action can make many action callback
And You Can Run :
Filter
Filter make data can modification by multiple closure, this a helpfull for make Extension. Make Filter :
Apply Action :
For example, i make 2 function for modification a data $title
:
Menu Builder
This package include a simple menu builder, for make dynamic menu in your project,
this is a example :
And then, for render to string html, use this. For example i am make sidebar.blade.php
:
Unit Test
You can running test with phpunit with this command :
or : (installed phpunit via composer)
Examples
Making Dynamic css and javascript in html blade
For example, a make a page with dynamic component with Hook filter.
In layouts/app.blade.php
:
And in controlle :
And then, final result html is :
License
The MIT License (MIT). Please see License File for more information.