CLI Commands

Canvas includes Sculpt, a command-line interface for development workflow. Sculpt provides essential tools to understand, debug, and manage your Canvas applications.

Getting Started

Sculpt is available immediately after installing Canvas. Run it to display command list and usage information:

./vendor/bin/sculpt

Route Management

Get a complete overview of your application's routing structure:

./vendor/bin/sculpt route:list

This command displays all your routes in a table:

+-------+---------------------------------------+-----------------+
| Route | Controller                            | Aspects         |
+-------+---------------------------------------+-----------------+
| /henk | Quellabs\Canvas\Controller\Test@index | [CacheAspect]   |
+-------+---------------------------------------+-----------------+

Filter routes to show only those handled by a specific controller:

./vendor/bin/sculpt route:list --controller=UserController

Test which controller and method would handle a URL path:

./vendor/bin/sculpt route:match /url/path/10

Specify the HTTP method to test method-specific routing:

./vendor/bin/sculpt route:match GET /url/path/10

Clear the route cache to force route re-discovery:

./vendor/bin/sculpt route:clear_cache

Understanding the Output:

  • Route - The URL pattern that triggers this endpoint
  • Controller - The class and method responsible for handling requests
  • Aspects - Applied AOP aspects for cross-cutting concerns

Cache Management

Clear Smarty template cache:

./vendor/bin/sculpt smarty:clear_cache

This removes cached template files. Use this when template changes aren't appearing in your application.

Troubleshooting Routes

When a route doesn't behave as expected, verify:

  • The route was discovered by Canvas
  • The URL pattern matches your expectations
  • The correct controller method is mapped
  • Expected aspects are applied
  • Parameter extraction and validation work correctly
  • HTTP method routing behaves as expected

Recommended Workflow

Use Sculpt in your development process:

  1. Create controllers with @Route annotations
  2. Verify route discovery with sculpt route:list
  3. Apply aspects using @InterceptWith annotations
  4. Confirm aspect application through route listing
  5. Debug routing issues with route:list and route:match
  6. Test specific URLs with route:match to validate behavior

The Canvas Way: Canvas embraces "convention over configuration." Sculpt doesn't generate boilerplate—it helps you understand and work with your existing application structure.