PHP code example of siaoynli / plugin-store
1. Go to this page and download the library: Download siaoynli/plugin-store library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
siaoynli / plugin-store example snippets
return [
// 插件是否启用
'enabled' => env('PLUGIN_STORE_ENABLED', true),
// 路由前缀
'route_prefix' => 'plugin-store',
// API 中间件
'middleware' => ['api'],
// 上传配置
'upload' => [
'max_size' => env('PLUGIN_STORE_MAX_UPLOAD_SIZE', 50), // MB
'allowed_mimes' => ['application/zip', 'application/x-zip-compressed'],
'temp_path' => storage_path('app/plugin-store/uploads'),
'packages_path' => 'packages', // 解压目标(相对于 base_path)
],
// Composer 配置
'composer' => [
'binary' => env('COMPOSER_BINARY', 'composer'),
'timeout' => env('COMPOSER_TIMEOUT', 300), // 秒
'working_dir' => null, // 默认 base_path
],
// 自动发现
'discovery' => [
'auto_sync' => env('PLUGIN_STORE_AUTO_SYNC', true),
],
];
bash
php artisan migrate
bash
# 发布全部资源
php artisan vendor:publish --tag=siaoynli-plugin-store-assets
# 或按需单独发布
php artisan vendor:publish --tag=siaoynli-plugin-store-config
php artisan vendor:publish --tag=siaoynli-plugin-store-migrations
bash
php artisan vendor:publish --provider="Siaoynli\PluginStore\PluginStorePlugin"
bash
# 运行迁移
php artisan migrate
# 刷新插件缓存
php artisan plugin:cache
php artisan plugin:clear
# 查看已注册插件
php artisan plugin:list