jeroen-g / laravel-builder
此包已被废弃,不再维护。没有建议的替代包。
根据模板快速构建类。
v0.2
2016-03-17 11:47 UTC
Requires
- php: ~5.5|~7.0
- illuminate/console: ~5
- illuminate/filesystem: ~5
- illuminate/support: ~5
Requires (Dev)
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2022-02-01 12:56:01 UTC
README
从命令行构建您的Laravel应用程序,或者在未来某个时刻,通过界面进行构建。
安装
通过Composer
$ composer require jeroen-g/laravel-builder
在config/app.php中添加
JeroenG\LaravelBuilder\LaravelBuilderServiceProvider::class,
用法
在您的代码中
在服务提供者中绑定了一个构建类的实例。您可以在以下方式之一中使用Builder。模板在stubs/
目录中搜索,因此首先运行该命令(见下一节)。
- 使用变量
$builder->stub = 'model'; // model.stub found in stubs/ $builder->namespace = 'App\\Models'; $builder->class = 'Test'; $builder->path = 'app/Models/Test'; // Relative to base_path(). $builder->run()->save(); // Creates and then saves the file. $builder->reset(); // Resets the variables for a completely new build process.
- 使用数组
$builder->fromArray([ 'stub' => 'model', 'namespace' => 'App\\Models', 'class' => 'Test', 'path' => 'app/Models/Test' ]); // No need to run() or save() or reset().
- 使用Json
$json = json_encode([ // You could for example have .json files for this. 'stub' => 'model', 'namespace' => 'App\\Models', 'class' => 'Test', 'path' => 'app/Models/Test' ]); $builder->fromJson($json); // No need to run() or save() or reset().
命令行
您还可以使用以下命令。
- 将所有包含的模板发布到
stubs/
目录。
$ php artisan build:stubs
您也可以将您自己的模板添加到这个目录中。它目前包含很少的模板,如果您有自己制作的,请随意通过Pull Request将其添加到包中。
- 构建文件
$ php artisan build model App\\Models Test app/Models/Test
通过Web界面
安装包并发布模板后,可以通过访问/builder
来访问Web界面。您可以创建单个文件或资源(控制器、模型、表单请求、策略、迁移、视图)。
变更日志
请参阅变更日志以获取更多信息。
测试
$ composer test
贡献
请参阅贡献以获取详细信息。
致谢
许可
EUPL许可。请参阅许可文件以获取更多信息。