Tools
Novis comes with its own tools for writing, testing and debugging a program. Most of them are
commands of the nvs program, so you install them when you install Novis. Each picture below is
made from a real run of the tool.
The editor extension adds Novis to VS Code. It colours your code, shows errors while you type and completes names.
What this recording shows
- Type
em. A list of suggestions opens. It showsemail. - Press Enter to choose
email.
The formatter is nvs fmt. It changes the layout of your code to one fixed style.
nvs fmt --diff cart.nvs--- cart.nvs+++ cart.nvs@@ -1,11 +1,15 @@ <?nvs-class Cart {- public int $total = 0;- public function add(int $price): void {- $this->total = $this->total + $price; }+class Cart+{+ public int $total = 0;+ public function add(int $price): void+ {+ $this->total = $this->total + $price;+ } } Cart $cart = new Cart();-$cart->add(1200); $cart->add(350);- echo $cart->total, "\n", "done";+$cart->add(1200);+$cart->add(350);+echo $cart->total, "\n", 'done';exit 1The test runner is nvs test. It runs your tests and can write a
coverage report.
nvs test prices.nvs PriceTest ✓ addsTwentyPercent 0.3 ms ✓ zeroStaysZero 0.3 ms - roundsHalfCents 0.0 ms skipped: rounding is not decided yet 0 failed, 2 passed, 1 skipped, 0 flaky in 1 msThe command line is the nvs program itself: nvs run, nvs check, nvs serve and the other
commands.
nvs check cart.nvsno errorsnvs check order.nvserror[E0401]: expected `int`, found `string` --> order.nvs:8:17 |8 | $order->total = 'seven'; | ^^^^^^^ this is `string`error: aborting due to 1 errorTo read what a code means and how to fix it, run `nvs agent show <code>`.exit 1The debugger stops your program at a line, so you can look at its variables. Your editor connects to
it through nvs dap.
What this recording shows
- Set a breakpoint on line 7 and start debugging. The program stops on line 7.
$wordsisarray(3),$totalis0and$countis120. - Press F5 to continue. The program stops on line 7.
$wordsisarray(3),$totalis120and$countis340. - Press F5 to continue. The program stops on line 7.
$wordsisarray(3),$totalis460and$countis95. - Press F5 to continue. The program runs to its end. It ends with exit code
0.
The debug viewer is nvs debug. It shows in your browser each request that your server handled.

The profiler shows where your program spends its time.

The API document is the OpenAPI description of your routes. nvs build --openapi writes it.
nvs build --openapi shop.nvs{ "info": { "title": "shop", "version": "0.0.0" }, "openapi": "3.1.0", "paths": { "/orders/{id}": { "get": { "operationId": "Orders.show", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "minimum": 0, "type": "integer" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "type": "string" } } }, "description": "success" } }, "summary": "Shows one order." } } }}