Download the PHP package arkadiuszbachorski/laravel-xmake without Composer
On this page you can find all versions of the php package arkadiuszbachorski/laravel-xmake. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arkadiuszbachorski/laravel-xmake
More information about arkadiuszbachorski/laravel-xmake
Files in arkadiuszbachorski/laravel-xmake
Package laravel-xmake
Short Description Extended Laravel Artisan Make Command
License MIT
Homepage https://github.com/arkadiuszbachorski/xmake
Informations about the package laravel-xmake
Additional Laravel Artisan xmake command for faster resource creating and scaffolding. Created to speed up developing process and stop typing same things in various places.
Table of contents
- Getting started
- Prerequisites
- Installation
- Features
- Usage
- To-do list
- Documentation
Getting started
Prerequisites
This package was developed for Laravel 5.8 and up. I haven't tested earlier versions yet.
Installation
Require this package with composer for development only.
Publish config
Change default resource paths if you would like to.
Publish resources
Features
- Scaffold your app quicker
- Create many related files with just one command: model, controller, request, resource, migration, seeder and factory
- Provide fields in one place, rest will be prepared or even filled for you
- Easily customize stubs for your needs
Usage
You'd rather see than read?
Example:
Result
FoobarController.php
Foobar.php
FoobarRequest.php
Pretty nice, huh? For more details and possibilities, see documentation.
To-do list
- Guessing factory based on validation and migration field type
- Guessing migration field type based on validation
Documentation
- Config
- Stubs
- Fields
- Commands
- xmake
- xmake:model
- xmake:controller
- xmake:resource
- xmake:migration
- xmake:request
- xmake:factory
- xmake:seeder
- Summary
Config
config/xmake.php
Stubs
Stubs can be found in /resources/xmake/stubs path by default. You will see a few text files there. All of them contain "Dummy..." content, that means it will be replaced by generated things. Everything what isn't prefixed with "Dummy..." can be customised by you.
Fields
Fields file can be found in /resources/xmake/fields.php path by default. It's a source of data about fields.
You don't have to fill in all the data about each field. The only required one is the "name". If you enter unknown field to --fields option, it will be treated as the key is the name and the other parameters are empty.
This means you can completely ignore this file if you would like just list every field in created files.
However Xmake has a few self-filling and data processing mechanisms as you could see in config. If you provide database field there is probability of getting at least some of repetitive things filled in validation and factory.
Commands
Every command has --help, so you can check available options faster than checking here.
In examples below I assume default config and file fields.php contains:
xmake
It's a command that will be used most often, because it gives powerful scaffolding ability. It can call every single command listed below.
Xmake by default runs interactive shell experience. If you would like to create resources even faster - use --instant flag. Results are almost the same, but you can't name your files independently. Probably you wouldn't do it anyway, because auto-naming works great.
Available options
--instant -i
Use this flag if you want don't want to use interactive shell.
--modelName
This parameter is required, almost every command uses it.
--fields
Get fields keys array, use comma as separator
--all
Create everything based on your config. By default - it's literally everything.
--api
Create API version of Controller and enable resource creating
--model
Create model with given modelName
--migration
Create migration with given fields prepared or filled
--factory
Create factory with given fields prepared of filled
--seeder
Create seeder that invokes factory
--request
Create request with given fields prepared or filled
--resource
Create resource with given fields prepared of filled
--controller
Create controller with various options - request, resource and api, based on your previous choices.
xmake:model
It simply creates model.
Example
Result: _Foobar.php_xmake:controller
It creates controller with:
- basic CRUD operations for your model
- Blade views or REST API
- Validation inside or injected
Available options
--model -m
It's required. You must provide your models name.
--api
It's a flag that changes responses from Blade views to REST API.
--fields
You can provide fields for validation there.
--resource -x
It injects given resource to index, store, show, edit and update returns. It does nothing when no --api flag provided.
--request -r
It injects given request to create and update methods. If the file doesn't exist - it can be created with fields you provided.
Example
Result:xmake:resource
It creates resource with given fields filled. It makes fields name camelCase by default, however it can be changed in config.
Available options
--fields
Example
Result:xmake:migration
It creates migration with given fields prepared or filled.
Available options
--create
Table name
--fields
Example
Result:xmake:request
It creates request with given validation rules prepared or filled.
Example
Result:xmake:factory
It creates factory with given factory rules prepared or filled.
Example
Result:xmake:seeder
It creates seeder with given model.
Available options
--model
Model name.
--amount
Number of models to be created in seeder. Default value can be changed in config.
Example
Result:Summary
All the above files can be created with just one command: