Download the PHP package bakgul/laravel-file-creator without Composer
On this page you can find all versions of the php package bakgul/laravel-file-creator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bakgul/laravel-file-creator
More information about bakgul/laravel-file-creator
Files in bakgul/laravel-file-creator
Package laravel-file-creator
Short Description This package aims to create the app, database, and test files. It can be a replacement for Laravel's file generator because this package offers some quite nice features. It offers extra file types like interface, trait, service, etc. Depending on the settings, it can create dozens of files with a single command and connect them to each other properly.
License MIT
Informations about the package laravel-file-creator
Laravel File Creator
This package aims to create the app, database, and test files. It can be a replacement for Laravel's file generator because this package offers some quite nice features. It offers extra file types like interface, trait, service, etc. Depending on the settings, it can create dozens of files with a single command and connect them to each other properly.
Update to v4
Config
If you didn't make any changes on config/packagify.php
, simply delete it and republish the settings. Otherwise, go to vendor/bakgul/laravel-file-creator/config/methods.php
, get the array and insert it to packagify.php
associated with the key named methods
.
Stubs
Controller uses a single stub file, and it generate everything on the fly. If you have custom controller stubs for different variations, you can't use them in this version unless you modify controller.stub
and make it work for you.
Service stub is also updated.
What is new?
- Task base invokable controller has become possible.
- Controller's methods' arguments, body, and return have become quite detailed and hopefully handy.
- Services contains basic implementations of their tasks and proper return types.
Installation
If you installed Packagified Laravel, you should have this package already. So skip installation.
Next, you need to publish the settings by executing the following command. By doing so, you will have a new file named packagify.php on the config folder. If you check the "files" array, you can see the file types that can be created. Quite deep explanations are provided in the comment block of the files array.
After publishing stubs, you will be able to update the stub files as you need. It's safe to delete the unedited files.
Command Signature
Arguments
-
name: subs/name:task
-
subs: You can specify subfolders like sub1/sub2/sub3 when you need a deeper file structure than the file types path_schema provides.
-
name: The file name without any suffix.
- task: This is optional.
- exist: You may set one or more tasks with a dot-separated fashion like "users:index" or "users:index.store.update." The task should be in the file type and its pairs' and the global task lists (see the tasks array on config/packagify.php). Otherwise, it will be ignored.
- missing: If the underlying file type has tasks, a separate file will be generated for each of them. Otherwise, a single file will be generated.
-
-
Type: name:variation:mod
-
name: It's required and should be one of the keys in the files array on config/packagify.php except for the view, css, js, livewire, and component. These keys will be used by Laravel Resource Creator. All detailed explanations can be found in the comment block of the files array.
-
variation: It's optional.
- exist: If the given file type has variations, you may specify which one should be created.
- missing: The default variation, which is the first item in the variations array, will be used.
- mod: When a veriation has different mods, you can speciy it here. For example, controller's variations have default and "api" modes. To create an api controller, you should use
controller::api
and to create a nested api, you should usecontroller:nested:api
. - `
-
-
Package: It won't be used when working on a Standalone Laravel or Standalone Package. If you don't specify a valid package name, the file will be generated in the App namespace.
- App: Some files, like the controller, may have app-specific. When I say app, I mean admin, web, desktop, etc. To create those files in the dedicated app folder, you must specify the app name. The settings are in the apps array on the config/packagify.php file.
Options
-
Parent: To create a nested controller, a parent model, or to create a listener, a parent event is required. Evaluator will warn you when a parent has to be specified.
-
Taskless: The file types that have tasks like service, or test, will be generated as a separate file for each task unless tasks are specified. But sometimes, you may want to create a single file without any task. In such cases, You need to append "-t" or "--taskless" to your command. This will cancel the default behaviour of the task explosion.
- Force: Normally, a file will not be regenerated if it exists. If this option is passed, a new file will be created anyway.
Packagified Laravel
The main package that includes this one can be found here: Packagified Laravel
The Packages That Will Be Installed By This Package
All versions of laravel-file-creator with dependencies
bakgul/kernel Version ^4.0
bakgul/file-content Version ^4.0
bakgul/file-history Version ^4.0
bakgul/command-evaluator Version ^4.0
bakgul/laravel-helpers Version ^1.0