CLI Tools
CLI Tools
Hazaar provides a suite of command-line tools to help you manage, develop, and maintain both the Hazaar framework and your application. These tools are built using the powerful Hazaar console classes such as Hazaar\Console\Application and Hazaar\Console\Module, which provide a modular and extensible foundation for CLI development.
These CLI tools allow you to:
- Manage application configuration and structure
- Work with files, encryption, and geodata
- Generate and maintain API documentation
- Control and monitor background services and agents
- Streamline development and operational workflows for Hazaar-based projects
They are designed to be easy to use, scriptable, and consistent across platforms, making it simple to automate and manage all aspects of your Hazaar application from the command line.
Hazaar CLI
The hazaar tool is available in the vendor/bin directory of your application, or globally if installed. You can run it from the command line like this:
$ hazaar
Hazaar Tool v0.3.0
Environment: development
Hazaar Console Application
Usage: hazaar [GLOBAL OPTIONS] [COMMAND OPTIONS]
Global Options:
--env, -e <ENV> The environment to use. Overrides the APPLICATION_ENV environment variable
Available Commands:
config View or modify the application configuration
create Create a new application object (view, controller or model)
doc Work with API documentation
file Work with files and encryption
geo Cache the geodata database file
help Display help information for a commandTo see available commands and options, run:
$ hazaar helpCommand Reference
help
Display help information for a command:
hazaar help [command]config
View or modify the application configuration. Configuration keys use dot-notation (e.g., database.host).
- View config:
hazaar config get app.theme - Set config:
hazaar config set app.name "My Test App"
create
Create a new application object (layout, view, controller, controller_basic, controller_action, model) from a template. This helps you quickly scaffold new components for your application.
hazaar create controller MyController
hazaar create model MyModel
hazaar create view MyViewfile
Work with files and encryption. You can encrypt and decrypt files, check if a file is encrypted, and view encrypted file contents. The check command will set an exit code of 1 if the file is encrypted, which is useful for scripting and automation.
- Check if a file is encrypted (exit code 1 if encrypted):
hazaar file check secure.json - Encrypt a file:
hazaar file encrypt secure.json - Decrypt a file:
hazaar file decrypt secure.json - View the contents of an encrypted file:
hazaar file view secure.json
doc
Work with API documentation. Use this to compile source documentation into markdown for use in API documentation systems like VuePress. The index command can generate a VuePress sidebar index.
- Compile documentation:
hazaar doc compile - Generate documentation index (for VuePress sidebar):
hazaar doc index
geo
Work with the geodata database used by Hazaar\Util\Geodata. This command helps manage and cache geodata required by your application. For more information, see the Hazaar\Util\Geodata source file.
hazaar geoWarlock CLI
Warlock CLI documentation has moved to the Warlock component section: