Luminova Framework

PHP Luminova: Novakit Commands Execution

Last updated: 2026-11-28 20:57:12

Novakit is the built-in CLI tool in Luminova that handles everything from code generation to environment setup and custom command execution.

The Novakit is the built-in Command Line Interface (CLI) tool for the Luminova Framework. It simplifies development tasks by allowing you to execute and manage various operations directly from the terminal.

The NovaKit CLI is powered by a novakit PHP Shebang file located at the project root. This is a special PHP script with a shebang line (#!/usr/bin/env php) that makes it executable like a native terminal command.


What Does Novakit Do?

Novakit acts like a routing system for CLI commands. It prepares the command input and passes it to the correct controller, just like Luminova’s HTTP routing system does for web requests.

With Novakit, you can:

  • Generate boilerplate code, controllers, and scaffolds.
  • Manage environment variables and config files.
  • Run database tasks like:
    • Migrations
    • Versioning
    • Seeding
  • Schedule and execute cron jobs.
  • View or clear application logs.
  • Start a local PHP development server.
  • Run Composer commands more easily.
  • And more — fully customizable to your application needs.

For a full reference, see the list of available Novakit commands in the documentation.


Novakit Class

The Novakit class provides a collection of methods for managing CLI commands internally.It includes utilities for registering custom console commands, verifying whether a command exists, and handling other command-related operations.

All methods in this class can be called statically from anywhere in your application when needed.


Novakit Console Commands

To build your own CLI commands using NovaKit console:

  1. Extend the Luminova\Base\Cli\AbstractConsole class.
  2. Define your logic in run(...) method.
  3. Register your commands in CLI novakit command file (/bin/.novakit-console.php).

Once created, you can run the command via:

php novakit your-command

Novakit dispatches registered console commands directly to their controller.

For details on creating custom commands, see: Base Console Controller


Class Definition

  • Class namespace: Luminova\Command\Novakit

Methods

run

Entry point for executing Novakit CLI commands.

public static function run(Input|array $input): never

Parameters:

ParameterTypeDescription
$inputInput|string[]The command input instance or raw arguments from $argv or $_SERVER['argv'].

Return:

never - This method always terminates the process.

Example:

use Luminova\Command\Novakit;

Novakit::run($_SERVER['argv'] ?? []);

find

Find the fully qualified controller class for a given command.

This method attempts to resolve the command to a known controller class. It first checks predefined system commands, then searches registered console commands based on the provided mode (system or global).

public static function find(string $group, string $mode = 'global'): ?string

Parameters:

ParameterTypeDescription
$groupstringThe command group string (e.g., create:controller, db:migrate, foo).
$modestringThe lookup mode: system for internal commands, or global for custom/console commands.

Return:

class-string<AbstractConsole>|null - Returns the fully qualified class name if found, or null if not.


command

Registers a new console command with an optional metadata definition.

This method maps a command name to its controller class and optionally stores command metadata such as group, description, usage examples, options, and more.

public static function command(string $group, string $class, array $properties = []): bool

Parameters:

ParameterTypeDescription
$groupstringThe command group name (e.g., 'foo').
$classclass-string<AbstractConsole>The fully qualified class name that handles the command.
$propertiesarray<string, mixed>(optional) Additional metadata for the command based on protected properties.

Return:

bool - Returns true on registration or false if the name is already registered or the class does not exist.

Examples:

Registering a basic command:

Novakit::command('foo', App\Console\FooCommand::class);

Registering a command with metadata:

Novakit::command('foo', App\Console\FooCommand::class, [
    'group' => 'Bar',
    'description' => 'Foo command',
    'usages' => [
        'php novakit foo'
    ],
    'options' => [
        '-b, --bar' => 'To run bar'
    ],
    'examples' => [
        'php novakit foo -b="Bra"' => 'Execute bra'
    ]
]);

get

Get a specific property from a registered command's metadata.

public static function get(string $group, string $property): mixed

Parameters:

ParameterTypeDescription
$groupstringThe command group name.
$propertystringThe property name to retrieve (e.g., 'group', 'description').

Return:

mixed - Returns the value of the specified property if it exists, or null otherwise.


getCommand

Retrieve full metadata for a command based on its protected controller properties.

The returned array may include the following keys:name, group, description, usages, options, examples, etc.

public static function getCommand(string $group, string $mode = 'global'): array

Parameters:

ParameterTypeDescription
$groupstringThe command group name.
$modestringThe command mode to check within (supported: system or global).

Return:

array<string,mixed> - Returns an associative array of command metadata.


has

Check if a command exists globally (i.e., user-defined or console command).

public static function has(string $group): bool

Parameters:

ParameterTypeDescription
$groupstringThe command group to check.

Return:

bool - Returns true when the command is recognized.