yangweijie/thinkphp-package-tools
最新稳定版本:v1.0.8
Composer 安装命令:
composer require yangweijie/thinkphp-package-tools
包简介
thinkphp 扩展包开发工具
README 文档
README
参考laravel-package-tools 实现的开发ThinkPHP扩展的包
This package contains a PackageService that you can use in your packages to easily register config files,
migrations, and more.
Here's an example of how it can be used.
use Spatie\LaravelPackageTools\PackageServiceProvider; use Spatie\LaravelPackageTools\Package; use MyPackage\ViewComponents\Alert; use Spatie\LaravelPackageTools\Commands\Concerns; class YourPackageServiceProvider extends PackageServiceProvider { public function configurePackage(Package $package): void { $package ->name('your-package-name') ->hasConfigFile() ->hasViews() ->hasViewComponent('spatie', Alert::class) // 仅laravel 迁移过来的扩展 ->hasViewComposer('*', MyViewComposer::class) // 仅laravel 迁移过来的扩展 ->sharesDataWithAllViews('downloads', 3) // 仅laravel 迁移过来的扩展 ->hasTranslations() // 仅laravel 迁移过来的扩展 ->hasAssets() ->publishesServiceProvider('MyProviderName') ->hasRoute('web') ->hasMigration('create_package_tables') ->hasCommand(YourCoolPackageCommand::class) // 无需在 composer.json 中注册命令 ->hasInstallCommand(function(InstallCommand $command) { // 添加独立的安装命令 $command ->publishConfigFile() ->publishAssets() ->publishMigrations() ->copyAndRegisterServiceProviderInApp() ->askToStarRepoOnGitHub(); }); } }
Under the hood it will do the necessary work to register the necessary things and make all sorts of files publishable.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-04