conquest / command
Artisan commands to rapidly develop your apps.
Fund package maintenance!
Conquest
Requires
- php: ^8.2
- illuminate/console: ^10.0||^11.0
- illuminate/contracts: ^10.0||^11.0
- illuminate/support: ^10.0||^11.0
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
README
Conquest Command is a package to rapidly generate boilerplate code for your monolithic Laravel application using Artisan.
Users will need to publish the applications stubs
to override them, as they are built by default for the private Conquest Legion
boilerplate kit.
Installation
You can install the package via composer:
composer require conquest/command
Customise the paths and extensions through by publishing config file with:
php artisan vendor:publish --provider="Conquest\Command\ConquestCommandServiceProvider" --tag="config"
This is the contents of the published config file:
return [ 'extension' => 'vue', 'paths' => [ 'page' => 'js/Pages', 'modal' => 'js/Modals', 'component' => 'js/Components', ], 'base_route' => 'dashboard', ];
You should also publish the stubs to customise them:
php artisan vendor:publish --provider="Conquest\Command\ConquestCommandServiceProvider" --tag="stubs"
Usage
Use the provided commands to generate the boilerplate files via CLI. The available commands are:
php artisan make:page php artisan make:modal php artisan make:conquest php artisan make:js-component php artisan user:make php artisan add:route
User Creation
It is strongly recommended you extend the UserCreateCommand
to fit your user creation flow. This command is only designed for the Laravel starter kits, using the UserFactory
that is provided.
Some methods are provided, but not implemented for this command. By extending, you can opt into them without needing to write the option methods yourself.
Conquest
Conquest is a compound command, using highly opionated conventions to generate out controllers, requests and Javascript pages (by default), with the ability of generating complete file structures dependent on the options provided to it. All arguments to the command must be camel-cased and in the form ModelMethod
. The method must be the final part of the argument.
By default, passing ModelMethod
will create a Request
and single-action Controller
, with a Page
or Modal
being generated if the method segment of the name matches the required case.
If you do include options, your name argument must contain one of the 8 keywords, or no keyword at all. Having other names can result in undesirable naming conventions to be generated.
The naming convention uses 8 keywords to generate out different files.
Index
: Generates a pageShow
: Generates a page by default, --modal flag will generate a modalCreate
: Generates a form page by default, --modal flag will generate a form modalStore
: No pageEdit
: Generates a form page by default, --modal flag will generate a form modalUpdate
: No pageDelete
: Generates a modal by default, --page flag will generate a pageDestroy
: No page
It will additionally remove pluralisation from the model name, and use the singular form for the file names.
The complete list of options to provide is:
--page
: Force a page to be generated--modal
: Force a modal to be generated--model
: Generates a model, and cretaes the desired endpoint--seeder
: Generates a seeder for the given--model
, if not supplied, nothing will happen--factory
: Generates a factory for the given--model
, if not supplied, nothing will happen--migration
: Generates a controller for the given--model
, if not supplied, nothing will happen--policy
: Generates a policy for the givenModel
--resource
: Generates a resource for the givenModel
--crud
: Will create all 8 actions for a givenModel
name--force
: Overwrites existing files. Applies to all files to be generated--route
: Add the endpoint(s) to the end of yourweb.php
, or theroute/
file specified as the argument. Ifcrud
is specified, this will also group the arguments under a header--all
: Executes all available options
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.