Download the PHP package wamesk/laravel-commands without Composer
On this page you can find all versions of the php package wamesk/laravel-commands. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-commands
Laravel Commands
Laravel package for better artisan commands for making Model etc.
- Laravel Commands
- Installation
- Usage
- Make command
- Model command
- Nova resource command
- Migration command
- Observer command
- Events command
- Listeners command
- Api controller command
- Lang command
- Policy command
- Utils
- Helpers
- Create directory
- Create and/or open file
- Camel Case converter
- Validator
- Validate function
- Code function
- Status Code function
Installation
Use this command to publish config.
You can find config in config folder as shown below.
You can configure package commands here
Usage
Make command
This command will run all php artisan
commands listed below.
- wame:api-controller
- wame:events
- wame:lang
- wame:listeners
- wame:migration
- wame:model
- wame:nova
- wame:observer
- wame:policy
Run command with name parameter at the end. Name parameter is your Model name. (example: User)
After running this command it will ask you if you want to make custom configuration.
You can choose between yes and no.
If you choose no (default) it will run all commands. Note: Make sure you have set your config file.
If you choose yes it will ask you which commands should run (Default being yes). (Example shown below)
Note: if you make a custom configuration while running command it will ignore commands set false in config file.
Model command
This command will create base Model with preset methods.
It is configurable by these configs.
Run this command using
Nova resource command
This command will create base Nova resource with preset methods.
It is configurable by these configs.
Run this command using
Migration command
This command will create base Migration with preset columns.
It is configurable by these configs.
Run this command using
Observer command
This command will create base Observer with preset functions and Events.
Run this command using
Events command
This command will create base Events with preset construct, function and classes.
Run this command using
Listeners command
This command will create base Listener jobs.
Run this command using
Api controller command
This command will create base api Controller with preset functions, responses and validation. It will also create base Model Resource and include it in Controller.
Run this command using
Lang command
This command will create language files according to the languages defined in the config.
Output
Run this command using
Policy command
This command creates a policy if you use the serenysoft/nova-permissions library
Utils
Functions used in commands and for your project are documented here.
Helpers
Include this util in your file using
Create directory
Helpers::createDir()
function is used to create directory in your project.
It requires directory path parameter (string) and optional second parameter with chmod rule.
This function starts at app folder.
Create and/or open file
Helpers::createFile()
function is used to create file and/or open file in your project.
It requires path of file, name and extension parameter (string) and optional second parameter is mode (string) Example: 'w' / 'r'.
This function starts at app folder.
Camel Case converter
Helpers::camelCaseConvert()
function is used to convert string
It requires string parameter to convert.
Second parameter is separator (string) (default: '_'). Optional parameter.
Third parameter is lower (bool) (default: false). Optional parameter. Changes if words should start with lower case.
Example:
Validator
Validator used by default in this package.
It works by chaining functions and getting response.
Response is generated by wamesk/laravel-api-response
package functions.
To better understand how response works checkout documentation for response package here
Validate function
This function is final function. Always last. It requires data and rules for validation. Documentation for rules click here
Usage example:
In case of validation error it will return
Code function
This function is add internal code in response. You can pass second parameter that changes prefix for message translation.
Usage example:
In case of validation error it will return
Status Code function
This function doesn't change response visually but changes status code of response. Default status code is 400 (Bad Request). If you want to chain all functions it can look like this. Status code is always integer.
All versions of laravel-commands with dependencies
eminiarts/nova-tabs Version ^2.1
laravel/framework Version ^9.0|^10.0
outl1ne/nova-sortable Version ^2.0|^3.0
wamesk/laravel-api-response Version ^1.0
wamesk/utils Version ^1.0