A powerful, extensible command-line toolkit that seamlessly integrates with ObjectQuel ORM.
Sculpt provides an elegant command-line interface for rapid development, code generation, and project management within the Quellabs ecosystem. It's designed to be intuitive for beginners yet powerful enough for advanced use cases.
- Unified Command Interface β Access commands from across the Quellabs ecosystem through a single CLI tool
- Service Provider Architecture β Robust plugin system allowing packages to register commands and services
- Extensible Design β Built from the ground up for customization and extension
- Smart Discovery β Automatically detects and loads commands from installed packages
- Cross-Package Integration β Enables seamless interaction between ObjectQuel and other components
- Developer-Friendly β Intuitive command structure with helpful documentation and auto-completion
- Parameter Management β Sophisticated handling of command-line parameters with validation and type checking
composer require quellabs/sculptOnce installed, you can run Sculpt commands using:
vendor/bin/sculpt <command>To see all available commands:
vendor/bin/sculptFor detailed help on a specific command:
vendor/bin/sculpt help <command>Sculpt is built around a few key concepts:
- Commands β The primary way users interact with Sculpt
- Service Providers β Register commands and extend functionality
- Configuration Manager β Handles command parameters and options
Commands in Sculpt follow a namespace pattern:
namespace:command
For example:
db:migrateβ Run database migrationsmake:modelβ Generate a model classcache:clearβ Clear application cache
Sculpt supports various parameter formats:
# Named parameters
vendor/bin/sculpt make:model --name=User --table=users
# Flags
vendor/bin/sculpt migrate --force --verbose
# Short flags
vendor/bin/sculpt migrate -fv
# Positional parameters
vendor/bin/sculpt make:controller UserSculpt uses a service provider pattern to discover and register commands from packages.
<?php
namespace Your\Package;
use Quellabs\Sculpt\Application;
use Quellabs\Sculpt\Contracts\ServiceProvider;
class SculptServiceProvider extends ServiceProvider {
/**
* Register your package's commands and services
*/
public function register(mixed $container): void {
// Register commands
$container->registerCommands($app, [
\Your\Package\Commands\YourCommand::class,
\Your\Package\Commands\AnotherCommand::class
]);
}
}In your package's composer.json:
{
"name": "your/package",
"extra": {
"discover": {
"sculpt": {
"provider": "Your\\Package\\SculptServiceProvider"
}
}
}
}Or:
{
"name": "your/package",
"extra": {
"discover": {
"sculpt": {
"providers": [
"Your\\Package\\SculptServiceProvider",
"Your\\Package\\SculptServiceProvider2",
]
}
}
}Commands should implement the CommandInterface or extend the BaseCommand class:
<?php
namespace Your\Package\Commands;
use Quellabs\Sculpt\Commands\BaseCommand;
use Quellabs\Sculpt\ConfigurationManager;
class YourCommand extends BaseCommand {
/**
* Get signature of this command
*/
public function getSignature(): string {
return 'your:command';
}
/**
* Get the description
*/
public function getDescription(): string {
return 'Description of your command';
}
/**
* Execute the command with parsed configuration
*/
public function execute(ConfigurationManager $config): int {
// Access command parameters
$name = $config->get('name', 'default-name');
$force = $config->hasFlag('force');
// Display information
$this->output->writeLn("<bold>Executing command for: {$name}</bold>");
if ($force) {
$this->output->warning("Force flag is enabled!");
}
// Command implementation here...
$this->output->writeLn("<green>Command completed successfully!</green>");
return 0; // Return 0 for success, non-zero for errors
}
}The ConfigurationManager provides a clean way to access command parameters:
// Get a named parameter with a default value
$name = $config->get('name', 'default-value');
// Check if a flag is set
if ($config->hasFlag('force') || $config->hasFlag('f')) {
// Do something forcefully
}
// Get a positional parameter
$firstArg = $config->getPositional(0);
// Validate parameter format
$email = $config->getValidated('email', '/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/');
// Validate parameter is one of allowed values
$env = $config->getEnum('environment', ['development', 'staging', 'production']);
// Require certain parameters
$config->requireParameters(['name', 'type']);Contributions are welcome! Here's how you can help:
- Report bugs β Open an issue if you find a bug
- Suggest features β Have an idea? Share it!
- Submit PRs β Fixed something or added a new feature? Submit a pull request
Please ensure your code adheres to our coding standards and includes appropriate tests.
Sculpt is open-source software licensed under the MIT license.
