Alright, now that Laris is installed and ready to roll, it’s time to have some real fun.
You didn’t come here just to install stuff and walk away — you came here to build things faster, and maybe even impress yourself a little.
Laris isn’t just another wrapper for php artisan. It’s your personal assistant with shortcuts, power tools, and AI magic — all packed in a clean command-line interface.
We’re going to walk through every command — one by one — like a cooking show, but for code.
No pressure. No mess. Just tasty tools to save your time.
You’ll learn:
laris:ai:config — Configure Your AI AssistantThe laris:ai:config command launches an interactive configuration wizard to set up your preferred AI provider (OpenAI or OpenRouter) for use within Laris CLI.
This command allows you to define:
openai or openrouter.deepseek/deepseek-r1-0528-qwen3-8b:free).Once completed, the configuration is saved to a .laris-ai.json file in the root of your project directory.
~> laris laris:ai:config
🤖 Laris AI Configuration Wizard
This setup will configure your AI provider, API key, and default behavior.
You can change these settings anytime by running this command again.
[?] Select your AI provider: openrouter
[?] Select Ai Model: deepseek/deepseek-r1-0528-qwen3-8b:free
[?] Enter your API key for [openrouter]: *************
[?] Maximum tokens per completion?: 1000
[?] Default prompt prefix for AI assistant?: You are a Laravel assistant that helps generate code...
✅ AI configuration saved successfully!
📄 Path: /your-project/.laris-ai.json
laris:ai:generate:docs — Generate Documentation from PHP Class Using AIThe laris:ai:generate:docs command uses OpenRouter AI to analyze a given PHP class file and generate complete Markdown documentation for it. This is especially useful for creating consistent, high-quality documentation for your Laravel services, controllers, or other classes.
.md file.Before using this command, make sure you’ve configured your AI settings by running:
~> laris laris:ai:config
~> laris laris:ai:generate:docs app/Services/MyService.php
laris:ai:generate:module — Generate a Full Laravel Module Using AIThe laris:ai:generate:module command allows you to quickly scaffold a complete Laravel module using OpenRouter AI. This is ideal for bootstrapping new features with consistent structure and Laravel 10 best practices.
When you provide a module name (e.g. Product), the AI will generate:
All code is formatted using PSR-12 and adheres to modern Laravel 10 conventions.
Make sure your project is a valid Laravel project and that AI settings are configured using:
~> laris laris:ai:config
What is the name of the module? Product
🧠 Generating Laravel module with AI...
...
✅ AI Generated Code for Product Module
Do you want to save the files manually? [yes]
✅ Module generated and saved to: /your-project/ai-modules/Product.md
laris:ai:generate:readme — Generate a Professional README.md with AIThe laris:ai:generate:readme command allows you to generate a clean, structured, and professional README.md file for your Laravel project using OpenRouter AI.
The generated README typically contains the following sections:
All content is written in Markdown and designed for clarity and professionalism.
Before using this command, make sure to:
artisan file).~> laris laris:ai:generate:readme
Briefly describe your project (optional): A Laravel-based task management API.
📄 Generating README.md using OpenRouter AI...
✅ AI Generated README.md
Do you want to save this as README.md? [yes]
🎉 README.md file has been saved.
laris:ai:test:generate — Generate PHPUnit Test Class with AIThis command uses OpenRouter AI to generate a fully functional PHPUnit test class for a given Laravel class file.
artisan file must exist)~> laris laris:ai:test:generate
-Enter the path to the class (e.g., app/Services/MyService.php)
🧪 Generating test class using OpenRouter AI...
✅ AI Generated Test
Do you want to save this test? [yes]
✅ Test saved to tests/Feature/MyServiceTest.php
laris:ai:make:command — Generate Artisan Command ClassGenerate a Laravel Artisan command using OpenRouter AI.
~> laris laris:ai:make:command
What is the name of the Artisan command class? [CleanupOldPostsCommand]
🧠 Generating Artisan Command using AI...
✅ AI Generated Command Code
Do you want to save this command to app/Console/Commands? [yes]
✅ Command saved to app/Console/Commands/CleanupOldPostsCommand.php
Generate a Laravel controller class with CRUD methods using OpenRouter AI.
-Generates full CRUD methods (index, store, show, update, destroy) -Uses route model binding -Uses Form Requests where needed -PSR-12 compliant and Laravel 10 ready
~> laris laris:ai:make:controller
What is the name of the controller? [ExampleController]
🧠 Generating code using OpenRouter AI...
✅ AI Generated Controller Code
Do you want to save this controller to your Laravel project? [yes]
✅ Controller saved to app/Http/Controllers/ExampleController.php
laris:ai:make:event — Generate Laravel Event ClassGenerates a Laravel Event class using OpenRouter AI.
~> laris laris:ai:make:event
What is the name of the event? [ExampleEvent]
🧠 Generating event class...
Thinking...
✅ AI Generated Event Code
Save this event? [yes]
✅ Event saved to app/Events/ExampleEvent.php
Laris CLI includes a set of laris:ai:make:* commands that leverage OpenRouter AI to generate clean, PSR-12-compliant Laravel classes — instantly.
Each command follows a consistent structure and usage pattern, including:
.laris-ai.json configurationlaris:ai:refactor:classThe laris:ai:refactor:class command allows you to refactor any PHP class file using OpenRouter AI. It analyzes your existing code and returns a cleaner, more maintainable, and production-ready version following Laravel, PSR-12, and SOLID best practices.
~> laris laris:ai:refactor:class path/to/YourClass.php
🔍 Refactoring class using AI...
✅ Refactored Class
<?php
namespace App\Services;
class CleanedUpService {
// ...
}
laris:backupThe laris:backup command allows you to easily create a ZIP archive of your Laravel project while excluding unnecessary directories such as vendor, node_modules, .git, and sensitive files like .env.
~> laris laris:backup
Excludes the following paths from the archive:
vendor/node_modules/.git/.envbackups/ (to avoid nested backups).zip archive in the /backups directory at the root of your project.backup_20250617_141230.zip).Creating backup...
[OK] Backup created successfully at: /your-project/backups/backup_20250617_141230.zip
your-project/
├── app/
├── backups/
│ └── backup_20250617_141230.zip
├── vendor/ ← excluded
├── node_modules/ ← excluded
├── .env ← excluded
└── ...
This command is especially useful before running destructive operations or before pushing to production. Make sure to version your backups or move them off the server regularly. 🔐
laris:composerThe laris:composer command gives you an interactive interface to run common Composer tasks within your Laravel project—without needing to type full commands every time.
~> laris laris:composer
When you run the command, you will be presented with a list of actions:
update – Run composer updateinstall – Run composer installrequire – Prompt to install a Composer packageremove – Prompt to uninstall a Composer packagedump-autoload – Regenerate the Composer autoload filesquit – Exit the menuEach time you choose an option, the command executes the appropriate Composer command in your Laravel project root and displays the real-time output.
For example, if you choose:
> require
Enter package name to require (e.g. guzzlehttp/guzzle):
It will automatically run:
composer require guzzlehttp/guzzle
artisan).Composer options:
[0] update
[1] dump-autoload
[2] install
[3] require
[4] remove
[5] quit
> 0
Running: composer update
Loading composer repositories with package information...
...
This tool simplifies managing Composer dependencies directly from your Laris CLI workflow. Perfect for CI/CD pipelines, teams, or developers who prefer terminal automation.
laris:configThe laris:config command provides an interface to manage project-specific settings using a local .larisconfig.json file.
~> laris laris:config <action> [key] [value]
get <key> – Retrieve the value of a configuration keyset <key> <value> – Set or update a key with a value (supports JSON values)remove <key> – Delete a key from configurationlist – Display all configuration key-value pairs~> laris laris:config set api_url "https://example.com"
~> laris laris:config get api_url
~> laris laris:config remove api_url
~> laris laris:config list
All settings are stored in
.larisconfig.jsonin your project root.
laris:dbThe laris:db command provides CLI access to database operations using the LarisDB library.
~> laris laris:db <action> [table] [--options]
list-tables – List all database tablesdescribe-table <table> – Show table columns and structureselect <table> – Query records with filters and optionsinsert <table> --data='{"col":"val"}' – Insert new record(s)update <table> --where="id=1" --data='{"col":"newVal"}' – Update record(s)delete <table> --where="id=1" – Delete record(s)generate-fake <table> [--count=10] – Seed table with fake data--where="id=1,name!=Ali" – Filter conditions (supports =, !=, <, >, <=, >=)--order="id DESC" – Sort results--limit=10 – Limit records (default: 10)--offset=0 – Offset for pagination--fields="id,name" – Select specific fields--data='{"key":"value"}' – JSON data for insert/update--count=10 – Fake record count for generate-fake~> laris laris:db list-tables
~> laris laris:db describe-table users
~> laris laris:db select users --where="active=1" --limit=5
~> laris laris:db insert users --data='{"name":"Ali","email":"ali@example.com"}'
~> laris laris:db update users --where="id=1" --data='{"name":"Ali Updated"}'
~> laris laris:db delete users --where="id=2"
~> laris laris:db generate-fake users --count=20
ℹ️ Ensure your DB credentials are correctly configured in the command.
~> laris laris:deploy
The laris:deploy command prepares your Laris project for production deployment.
It performs the following steps automatically, depending on the files present in your project root:
composer.json exists)~> composer install --no-dev --optimize-autoloader
package.json exists)~> npm install
~> npm run production
artisan exists)~> php artisan config:cache
~> php artisan route:cache
~> php artisan view:cache
~> laris laris:deploy
Starting deployment preparation
Running composer install --no-dev --optimize-autoloader ...
> Loading composer repositories...
> Installing dependencies...
> Generating optimized autoload files
Composer dependencies installed
Running npm install ...
> Installing node modules...
npm packages installed
Running npm run production ...
> Compiling assets...
npm build completed
Clearing and caching Laravel config & routes ...
> Configuration cached successfully!
> Routes cached successfully!
> Views cached successfully!
Deployment preparation completed successfully.
~> laris laris:docker
Interactive Docker management for Laravel projects using docker-compose.
This command only works if you’re inside a Laravel project (i.e. artisan file exists).
| Option | Description |
|---|---|
| build | Build Docker images |
| up | Start Docker containers (-d) |
| down | Stop and remove containers |
| ps | Show running containers |
| logs | Show real-time logs (select service) |
| exec | Run a command inside a container |
| quit | Exit the Docker tool |
~> laris laris:docker
Docker options:
[0] build
[1] up
[2] down
[3] ps
[4] logs
[5] exec
[6] quit
> ps
Running: docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------
laravel-app docker-php-entrypoint php-fpm Up 9000/tcp
mysql docker-entrypoint.sh mysqld Up 3306/tcp
> logs
Enter service name for logs (empty for all): laravel-app
Running: docker-compose logs --tail 50 -f laravel-app
laravel-app | [17-Jun-2025 10:12:03] NOTICE: ready to handle connections
> exec
Enter service name to exec into: laravel-app
Enter command to run inside container: bash
Running: docker-compose exec laravel-app bash
root@container:/var/www#
docker-compose behind the scenes.-f).⚠️ Make sure
docker-compose.ymlexists and Docker is running.
~> laris laris:docs
Generates API documentation automatically from PHPDoc comments in your Laravel controllers.
| Option | Description | Default |
|---|---|---|
--path |
Path to controllers directory | ./app/Http/Controllers |
--output |
Output file path (Markdown or HTML format) | ./docs/api-docs.md |
~> laris laris:docs
This will:
app/Http/Controllers for controllers.docs/api-docs.md.~> laris laris:docs --path=modules/User/Controllers --output=storage/docs/user-api.md
# API Documentation
## Controller: App\Http\Controllers\UserController
### Method: getProfile
/**
~> laris laris:git
Interactively manage Git inside your Laravel project.
| Command | Description |
|---|---|
init |
Initialize a new Git repository |
status |
Show current Git status |
commit |
Stage and commit all changes |
push |
Push commits to the origin |
remote |
Add a new Git remote URL |
pull |
Pull latest changes from origin |
log |
Display concise Git log with graph |
quit |
Exit the interactive Git panel |
~> laris laris:git
You’ll see an interactive prompt:
Git options:
[init] Initialize git repository
[status] Show git status
[commit] Commit changes
...
You can use arrow keys or type the name of the option.
? Git options > commit
? Enter commit message: Add login form styles
Running: git add .
Running: git commit -m "Add login form styles"
artisan file must exist).git add . before committing.--oneline, --graph, and --all flags for better readability.git remote remove origin manually if needed.🔒 Safe & quick Git integration for Laravel developers.
~> laris laris:hook
Easily manage Git hooks (.git/hooks) in your Laravel project.
laris laris:hook {action} [--name=...] [--script=...]
| Action | Description |
|---|---|
list |
List all available Git hooks in .git/hooks |
add |
Add a Git hook file with a script |
remove |
Remove a Git hook |
show |
Display the contents of a specific Git hook |
| Option | Required for | Description |
|---|---|---|
--name |
add, remove, show |
Name of the hook (e.g. pre-commit) |
--script |
add |
Shell command(s) to insert into the hook |
pre-commit hooklaris laris:hook add --name=pre-commit --script="php artisan test"
Creates
.git/hooks/pre-commitwith the given script.
laris laris:hook show --name=pre-commit
laris laris:hook remove --name=pre-commit
laris laris:hook list
.git/hooks/).🚀 Perfect for automating tests, linting, or formatting before commits!
~> laris laris:new
Create or delete your own dynamic Laris CLI commands easily.
~> laris laris:new
Then follow the interactive prompts to either:
| Prompt | Purpose |
|---|---|
Action (create/delete) |
Choose whether to create or delete a command |
Command name |
Name like serve, migrate, etc. (auto-prefixed) |
Description (for create) |
Human-readable explanation shown in help output |
| Confirm (for delete) | Confirm before deleting files |
⚠️ Names are automatically prefixed with
laris:if you don’t include it.
When creating a command named laris:serve, two files are saved under Laris/Commands/Laris/:
LarisServe.php – The actual command classLarisServe.txt – Metadata about the commandThese built-in commands cannot be created or deleted:
laris:git, laris:docker, laris:composer, laris:db,
laris:npm, laris:config, laris:docs, laris:hook, laris:new
Attempting to overwrite/delete them will result in an error.
~> laris laris:new
# Choose: create
# Command name: build-assets
# Description: Compile frontend assets
Creates laris:build-assets command that prints:
This is the command laris:build-assets
laris laris:new
# Choose: delete
# Command name: build-assets
# Confirm: yes
laris:npm CommandManage npm, yarn, or pnpm commands via the CLI.
This command detects the package manager (npm, yarn, or pnpm) based on lock files in your project directory and allows you to interact with it directly for common tasks like installing packages, running scripts, updating dependencies, cleaning cache, and more.
~> laris laris:npm <action> [packageOrScripts...] [options]
| Argument | Required | Description |
|---|---|---|
action |
Yes | One of: install, update, run, build, cache-clean, scripts, version, npx |
packageOrScripts |
No | Package names (for install/update) or script names (for run/build). Can be multiple or comma-separated. |
| Option | Description |
|---|---|
--save-dev |
Add the installed package(s) as development dependencies |
--save |
Explicitly save package(s) as production dependencies |
--json |
(Currently unused) Future support for JSON output for scripts |
--force |
Force clean npm/yarn/pnpm cache |
installInstall dependencies or specific packages.
~> laris laris:npm install
~> laris laris:npm install axios vue --save
~> laris laris:npm install jest --save-dev
updateUpdate all or specific packages.
~> laris laris:npm update
~> laris laris:npm update vue
runRun one or more scripts defined in package.json.
~> laris laris:npm run dev
~> laris laris:npm run dev,watch
buildAlias for run build.
~> laris laris:npm build
cache-cleanClean the cache for the detected package manager.
~> laris laris:npm cache-clean
~> laris laris:npm cache-clean --force
scriptsList all available scripts in package.json.
~> laris laris:npm scripts
versionShow the current installed version of Node.js and the package manager.
~> laris laris:npm version
npxRun any command using npx.
~> laris laris:npm npx create-react-app my-app
Automatically detects package manager:
yarn.lock → uses yarnpnpm-lock.yaml → uses pnpmnpm# Install Tailwind CSS as dev dependency
~> laris laris:npm install tailwindcss --save-dev
# Run multiple scripts
~> laris laris:npm run dev,watch
# Clean cache forcibly
~> laris laris:npm cache-clean --force
# Check current versions
~> laris laris:npm version
select CommandSwitch between recently used Laravel projects from a stored history.
This command helps developers quickly navigate into different Laravel project directories they’ve worked on before — similar to a workspace/project switcher.
~> laris select
chdir) to the selected project path.This command is especially useful when managing multiple Laravel projects locally.
[1] blog => /Users/you/Projects/blog
[2] ecommerce => /Users/you/Projects/ecommerce
[3] admin-panel => /Users/you/Projects/admin-panel
Enter number: 2
Switched to: /Users/you/Projects/ecommerce
STDIN.You’re using a CLI tool like laris with multiple Laravel projects, and you want to switch to one quickly:
~> laris laris select
Then simply type the number of the project to switch context.